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.61k stars 459 forks source link

Offline Bundle Android - [@RNC/AsyncStorage]: NativeModule: AsyncStorage is NULL #1019

Closed iamsamuelhere closed 6 months ago

iamsamuelhere commented 8 months ago

What happened?

Version

1.19.3

What platforms are you seeing this issue on?

System Information

System:
  OS: macOS 13.5
  CPU: (10) arm64 Apple M1 Pro
  Memory: 82.09 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 18.14.2
    path: /usr/local/bin/node
  Yarn: Not Found
  npm:
    version: 9.5.0
    path: /usr/local/bin/npm
  Watchman: Not Found
Managers:
  CocoaPods:
    version: 1.12.1
    path: /Users/userone/.gem/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 22.4
      - iOS 16.4
      - macOS 13.3
      - tvOS 16.4
      - watchOS 9.4
  Android SDK: Not Found
IDEs:
  Android Studio: 2022.3 AI-223.8836.35.2231.10671973
  Xcode:
    version: 14.3/14E222b
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 11.0.20
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.72.4
    wanted: 0.72.4
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false

Steps to Reproduce

gmantuanrosa commented 8 months ago

I can get it working on the Native Android App that we have and working towards adding support for React Native on iOS but it gives me the same error as the first thing when Metro Bundler finishes building (since it runs async storage to store session tokens that we pass down from native side through native module).

I am using react-native 0.72.6 and async on 1.19.3.

ternaus commented 8 months ago

The same expo project. Works in iOS, but not in Android simulator:

"react-native": "0.72.6" "@react-native-async-storage/async-storage": "1.18.2"

 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
github-actions[bot] commented 6 months ago

This issue has been marked as stale due to inactivity. Please respond or otherwise resolve the issue within 7 days or it will be closed.