async-storage: [@RNC/AsyncStorage]: NativeModule: AsyncStorage is null (0.61.5)
I upgraded react-native from 0.59.8 to 0.61.5
Unlinked @react-native-community/async-storage
App builds successfully and splash screen comes. After that it says (In Android):
[@RNC/AsyncStorage]: NativeModule: AsyncStorage is null
- Run react-native link @react-native-community/async-storage
When I tried linking it says:
info Linking "@react-native-community/async-storage" iOS dependency
error Linking "@react-native-community/async-storage" failed.
If I try unlinking again (I already did before as I encountered error while upgrading), it says
info iOS module "@react-native-community/async-storage" is not installed
info Android module "@react-native-community/async-storage" is not installed
Why does it say @react-native-community/async-storage is not installed even after I installed the package?
I tried removing the package and installing again. Same errors
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 2
- Comments: 25 (9 by maintainers)
Now I know why I dont have android folder files, I am Using
Expoand it does not support native modules likeasync-storagebecause it will look forsetting.gradleor other files inside your android folder or ios folder. See https://facebook.github.io/react-native/docs/getting-started atCaveatsIn other words, we need to use
react-native ejectorexpo eject@Krizzu Thanks, it removed the error. (But a lot of dependencies kept showing errors one after another. It’s a production app. So I created new project and migrated code to move fast)
@Krizzu I’m getting this now from a clean install.
"@react-native-community/async-storage": "^1.7.1",I did:
yarn add @react-native-community/async-storageimport AsyncStorage from '@react-native-community/async-storage';@elirichey I think auto-linking does not work with custom setup from Wix navigation - you have to manually install it. So you need to add an instance of AsyncStorage’s Package to your
getPackagesreturned array.@hebiao6446 This what you get when you print out Promise object. You need to either
awaitit or use.thento get the valueIf you upgraded from < 0.60 version, you need to unlink all your dependencies and then relay just on cli feature. Please read the docs to get more info.
If you started with version 0.60+, then autolinking should kick in. no
react-native linkis required. You just need to make sure that the setup you have follows the proper setup. Again, here are the docs for autolinking.If you’re below version 0.60, then you have to install the dependency manually or through
react-native link name-of-the-library. We have guides for manual linking hereI am facing this on Android too.How to resolve this?