question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

E/ReactNativeJS: Error: [@RNC/AsyncStorage]: NativeModule: AsyncStorage is null. Android Expo build

See original GitHub issue

Current 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

  1. Created project using expo bare workflow

  2. Web and Mobile project using yarn workspaces

  3. When I use apk using scanning code from expo server then AsyncStorage work successfully (expo start cmd use for running APK)

  4. If I use expo:build android -t apk then expo create apk on their platform

  5. Download that APK from the expo server

  6. If I install that downloaded APK, and start using it, on app lunch it crashed and give me the above error log

  7. 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:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
brentvatnecommented, Oct 20, 2020

when you run expo build:android -t apk you will see this:

╰─$ expo build:android -t apk
⚠️  expo build:android currently only supports managed workflow apps.
If you proceed with this command, we can run the build for you but it will not include any custom native modules or changes that you have made to your local native projects.
Unless you are sure that you know what you are doing, we recommend aborting the build and doing a native release build through Android Studio.
? Would you like to proceed? › (Y/n)

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

0reactions
SwapnilShorelinecommented, Oct 19, 2020

Hi @Krizzu @brentvatne , take a look into this

Read more comments on GitHub >

github_iconTop Results From Across the Web

NativeModule: AsyncStorage is null · Issue #768 - GitHub
Error : [@RNC/AsyncStorage]: NativeModule: AsyncStorage is null. To fix this issue try these steps: • Rebuild and restart the app.
Read more >
react native - NativeModule: AsyncStorage is null, with @RNC ...
This error can be rectified by linking the module like mentioned above but linking does not work if your app is Expo Managed...
Read more >
NativeModule: AsyncStorage is null EXPO EAS app - Reddit
i am having this issue for a while. To fix this issue try these steps: • Rebuild and restart the app. • Run...
Read more >
ERROR Error: [@RNC/AsyncStorage]: NativeModule - Medium
ERROR Error : [@RNC/AsyncStorage]: NativeModule: AsyncStorage is null. Rebuild and restart the app. Run the packager with '--reset-cache' flag.
Read more >
Updates - Expo Documentation
In development mode, or any other environment in which expo-updates is disabled, this value is null.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found