react-native-async-storage / async-storage

An asynchronous, persistent, key-value storage system for React Native.
https://react-native-async-storage.github.io/async-storage/
MIT License
4.62k stars 459 forks source link

another @RNC/AsyncStorage]: NativeModule: AsyncStorage is null #1003

Closed oshaleyko59 closed 10 months ago

oshaleyko59 commented 10 months ago

What happened?

Android Bundling complete 10043ms - just after completing build with eas and then trying to start app on Android, it crashes with error (rebuil-restart tried - no help, the same app works on Expo Go without any issue ):

ERROR Error: [@RNC/AsyncStorage]: NativeModule: AsyncStorage is null.

To fix this issue try these steps:

• 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-async-storage.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-async-storage/async-storage/issues , js engine: hermes ERROR Invariant Violation: "main" has not been registered. This can happen if:

Version

no dependancy on @react-native-async-storage/async-storage

What platforms are you seeing this issue on?

System Information

info Fetching system and libraries information...
System:
  OS: Windows 10 10.0.19045
  CPU: (8) x64 Intel(R) Core(TM) i5-10210U CPU @ 1.60GHz
  Memory: 5.48 GB / 15.81 GB
Binaries:
  Node:
    version: 18.16.0
    path: C:\Program Files\nodejs\node.EXE
  Yarn: Not Found
  npm:
    version: 9.5.1
    path: C:\Program Files\nodejs\npm.CMD
  Watchman: Not Found
SDKs:
  Android SDK: Not Found
  Windows SDK: Not Found
IDEs:
  Android Studio: AI-222.4459.24.2221.10121639
  Visual Studio: Not Found
Languages:
  Java:
    version: 11.0.17
    path: C:\Program Files\Common Files\Oracle\Java\javapath\javac.EXE
  Ruby: Not Found
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.72.3
    wanted: 0.72.3
  react-native-windows: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: Not found
  newArchEnabled: Not found
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found

Steps to Reproduce

it just happens with my environment - as far as i understand searching for the same, there is no clear understanding how to reproduce it

tido64 commented 10 months ago

Please see if https://github.com/react-native-async-storage/async-storage/issues/994#issuecomment-1676060963 helps:

I don't know if Expo autolinks native modules the same way vanilla React Native does, but assuming it does, you need to explicitly take dependency on AsyncStorage if any of your dependencies need it. Autolinking only links native modules that are found in the current project's package.json.

junjielyu13 commented 10 months ago

same error😟

oshaleyko59 commented 10 months ago

Please see if #994 (comment) helps:

I don't know if Expo autolinks native modules the same way vanilla React Native does, but assuming it does, you need to explicitly take dependency on AsyncStorage if any of your dependencies need it. Autolinking only links native modules that are found in the current project's package.json.

Yes! I did install react-native-async-storage/async-storage, even not using directly (but Firebase uses it) and it helped. However, I would expect the third-party dependencies are taken careof ...

oshaleyko59 commented 10 months ago

I did install react-native-async-storage/async-storage, even not using directly (but Firebase uses it) and it helped. However, I would expect the third-party dependencies are taken careof ... Expo itself runs perfectly without it