E/ReactNativeJS: Error: [@RNC/AsyncStorage]: NativeModule: AsyncStorage is null. Android Expo build
See original GitHub issueCurrent behavior
Find the below logs found when the app launches
2020-10-09 15:39:08.434 14910-14976/? E/ReactNativeJS: Error: [@RNC/AsyncStorage]: NativeModule: AsyncStorage is null.
To fix this issue try these steps:
• Run `react-native link @react-native-community/async-storage` in the project root.
• Rebuild and restart the app.
• Run the packager with `--reset-cache` flag.
• If you are using CocoaPods on iOS, run `pod install` in the `ios` directory and then rebuild and re-run the app.
• If this happens while testing with Jest, check out docs how to integrate AsyncStorage with it: https://react-native-community.github.io/async-storage/docs/advanced/jest
If none of these fix the issue, please open an issue on the Github repository: https://github.com/react-native-community/react-native-async-storage/issues
2020-10-09 15:39:08.460 14910-14976/? I/ReactNativeJS: Running “main” with {“initialProps”:{“exp”:{“lastErrors”:[{“isFatal”:true,“errorMessage”:“Error: [@RNC/AsyncStorage]: NativeModule: AsyncStorage is null.\n\nTo fix this issue try these steps:\n\n • Run react-native link @react-native-community/async-storage
in the project root.\n\n • Rebuild and restart the app.\n\n • Run the packager with --reset-cache
flag.\n\n • If you are using CocoaPo”,“exceptionId”:-322460846}],“initialUri”:“https://expo.io:443/@swap4949/ShorelineCloudV2",“manifest”:{“isVerified”:true,“version”:“0.0.1”,“id”:“@swap4949/ShorelineCloudV2”,“bundledAssets”:[“asset_516c07e9f2447fd9ae12b7aafb2abb0b.png”,“asset_12300732a817be0846b361b9b27a731b.png”,“asset_f4c4699a7807b76fb02760b0d13ee9a9.png”,“asset_f528602e0642d8224e1b68e630747a95.png”,“asset_b5f611f7f153660b49774e1225af9284.png”,“asset_20395fb867add3018b063d31972db21d.png”,“asset_9b81a625bcf4c426a6ce6d6c557d4f8f.png”,“asset_c2efb40bcd46493e8a5ff2ddb0449435.png”,“asset_41e8dead03fb979ecc23b8dfb0fef627.ttf”,“asset_342ba3d8ac29ac8c38d7cef8efbf2dc9.ttf”],“android”:{“versionCode”:1,“package”:“com.shoreline.shorelinecloud”},“bundleUrl”:“https://d1wp6m56sqw74a.cloudfront.net/%40swap4949%2FShorelineCloudV2%2F0.0.1%2F23d514928554c5d64b8ba61d7965279c-38.0.0-android.js”,“revisionId”:“0.0.1-r.LQspceznY”,“sdkVersion”:“38.0.0”,“platforms”:[“ios”,“android”,“web”],“releaseChannel”:“default”,“hostUri”:“exp.host/@swap4949/ShorelineCloudV2”,“commitTime”:“2020-10-09T09:18:20.237Z”,“dependencies”:[“@react-native-community/async-storage”,“@slcloud/constants”,“@slcloud/locale”,“@slcloud/models”,“@slcloud/shared”,“amazon-cognito-identity-js”,“aws-amplify”,“aws-amplify-react-native”,“expo”,“expo-splash-screen”,“expo-status-bar”,“expo-updates”,“native-base”,“react”,“react-dom”,“react-native”,“react-native-gesture-handler”,“react-native-loading-spinner-overlay”,“react-native-material-dropdown”,“react-native-reanimated”,“react-native-screens”,“react-native-toast-message”,“react-native-unimodules”,“react-native-web”,“react-redux”,“redux”,“redux-logger”,“redux-saga”,“redux-saga-effects”,“redux-thunk”],“locales”:{},“releaseId”:“be49b3c1-a9b4-492e-a1e9-5ad8343ef497”,“slug”:“ShorelineCloudV2”,“name”:“ShorelineCloudV2”,“ios”:{“buildNumber”:“0.0.1”,“bundleIdentifier”:“com.shoreline.shorelinecloud”},“loadedFromCache”:false,“publishedTime”:“2020-10-09T09:18:20.149Z”},“shell”:true}},"rootTag”:1}
2020-10-09 15:39:08.461 14910-14910/? D/AndroidRuntime: Shutting down VM
2020-10-09 15:39:08.462 14910-14910/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.shoreline.shorelinecloud, PID: 14910
java.lang.RuntimeException: Expo encountered a fatal error: Error: [@RNC/AsyncStorage]: NativeModule: AsyncStorage is null.
To fix this issue try these steps:
• Run `react-native link @react-native-community/async-storage` in the project root.
• Rebuild and restart the app.
• Run the packager with `--reset-cache` flag.
• If you are using CocoaPo
at host.exp.exponent.experience.f.o(BaseExperienceActivity.java:7)
at host.exp.exponent.experience.a.run(lambda)
at android.os.Handler.handleCallback(Handler.java:754)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:165)
at android.app.ActivityThread.main(ActivityThread.java:6375)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:912)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:802)
Expected behavior
Repro steps
-
Created project using expo bare workflow
-
Web and Mobile project using yarn workspaces
-
When I use apk using scanning code from expo server then AsyncStorage work successfully (expo start cmd use for running APK)
-
If I use expo:build android -t apk then expo create apk on their platform
-
Download that APK from the expo server
-
If I install that downloaded APK, and start using it, on app lunch it crashed and give me the above error log
-
If I remove AsyncStorage lib, and follow the above steps then app works fine, but I need this lib in my app.
Environment
- Async Storage version:1.12.0
- React-Native version: 0.63.0
- Platform tested: Android
- Logs/Error that is relevant: If we scan the app from expo client then it works fine, but if I tried to create APK using expo:build android -t apk then it crashed on app launch. -**“expo”: “~38.0.9”,
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:9 (4 by maintainers)
Top GitHub Comments
when you run
expo build:android -t apk
you will see this:i guess you proceeded anyways. you shouldn’t 😛 the build service currently only supports managed apps. feel free to dm me on twitter @notbrent and i can help you try out a preview of our new build service that supports bare react-native apps too.
@Krizzu - feel free to close this issue
Hi @Krizzu @brentvatne , take a look into this