expo: ExpoLocalization crashes on Android

Summary

We’ve started seeing crashes on Android after updating the expo localization dependency to 13.1.0.

The error is simply: Cannot find native module 'ExpoLocalization'

Happens on an import line: import * as Localization from 'expo-localization'

What platform(s) does this occur on?

Android

Environment

expo-env-info 1.0.5 environment info: System: OS: macOS 13.2 Shell: 5.8.1 - /bin/zsh Binaries: Node: 16.17.0 - /usr/local/bin/node Yarn: 3.2.2 - /usr/local/bin/yarn npm: 8.15.0 - /usr/local/bin/npm Watchman: 2022.11.28.00 - /opt/homebrew/bin/watchman Managers: CocoaPods: 1.11.3 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1 IDEs: Android Studio: 2021.2 AI-212.5712.43.2112.8815526 Xcode: 14.2/14C18 - /usr/bin/xcodebuild npmPackages: expo: 46.0.15 => 46.0.15 react: 18.2.0 => 18.2.0 react-native: 0.68.5 => 0.68.5 Expo Workflow: bare

Minimal reproducible example

We couldn’t reproduce the crash ourselves, but we’re seeing 1.5k crashes from our users in the past few months. And since we haven’t found similar reports on here, decided to check if it’s a known problem.

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 2
  • Comments: 15 (6 by maintainers)

Most upvoted comments

I got this error while developing. The problem was I needed to rebuild my apk with the new module since expo-localization uses native code. I’m using eas so I ran:

eas build --profile development --platform android

I installed the new build and the error went away.

Hope this helps someone.

@ser-emejia Are you testing this while using a remote debugger? It’s not supported with expo-modules and causes this exact thing 😕

I got something weird, I’m trying to get the timezone, but Localization.timezone is deprecated, so Expo docs recommend to use Localization.getLocales() but the returned array does not include anything about timezone, so I noticed that the Localization.getCalendars() return an array and it has a timezone property, But when log the calendars got this:

image

This is my code:

 const calendar = getCalendars();
 console.log(calendar);
image

getCalendars is not a promise

any idea?

Having the same error… any luck?

Project Version: Expo SDK 47 expo-localization version 14.1.1

how I import it: image

Error image: image

Yeah, it’s a bit of a smoke error, since it would indicate issues with new expo modules instead.

Also hard to say if it’s not specific to your setup or additional native code.

It will be impossible to fix without a reproduction, so the best course of action for you is to update dependencies to latest or attempt to reproduce based on user reports/manufacturer/OS version.

I cannot replicate the issue any more, sorry my bad I didn’t take note the first time.

I suspect the fix came from configuring the Android paths:

Open .zshrc and add the follow lines (replace username with your user path)

export ANDROID_HOME=/Users/<username>/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/platform-tools
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/tools/bin
export PATH=$PATH:$ANDROID_HOME/emulator

@aleqsio we added that as part of a future sprint and even once it gets pushed out will take a bit to know whether or not that fixed it. Will update here whenever that’s clear