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.

[Android] NativeModule: AsyncStorage is null when try autolinking.

See original GitHub issue

Current behavior

yarn add @react-native-community/async-storage and react-native run-andoid

and this error is shown.

Screenshot_20190826-102504

Hint

When I link it manually, https://github.com/react-native-community/async-storage/blob/LEGACY/docs/Linking.md#android

it works fine.

but this error is shown on the console.

error React Native CLI uses autolinking for native dependencies, but the following modules are linked manually:
  - @react-native-community/async-storage (to unlink run: "react-native unlink @react-native-community/async-storage")
This is likely happening when upgrading React Native from below 0.60 to 0.60 or above. Going forward, you can unlink this dependency via "react-native unlink <dependency>" and it will be included in your app automatically. If a library isn't compatible with autolinking, disregard this message and notify the library maintainers.
Read more about autolinking: https://github.com/react-native-community/cli/blob/master/docs/autolinking.md
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.

Expected behavior

autolinking works.

Repro steps

  1. yarn add @react-native-community/async-storage
  2. react-native run-andoid

Environment

  • Async Storage version : 1.6.1
  • React-Native version: 0.60.5
  • Platform tested: Android

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:5
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ianmcgregorcommented, Sep 2, 2019

Got the same error. Doing a cd android/ && ./gradlew clean before run-android fixed autolinking for me.

1reaction
Jakuubzmekocommented, Aug 30, 2019

@Krizzu It was the same, so I wanted to show you, so I unlinked them again, and edited the MainApplication.java then I ran it and it works just fine. What I think happend, that i did not unlink them properly before by react-native unlink, but just removed references from build.gradle and MainApplication.java. So maybe linking and unlinking helped. Still wandering what happened.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Android] NativeModule: AsyncStorage is null when try ...
it works fine. but this error is shown on the console. error React Native CLI uses autolinking for native dependencies, but the following ......
Read more >
react native - NativeModule: AsyncStorage is null, with @RNC ...
I run my app in the Simulator/Emulator (and device) through the Expo app. Once I tried ejecting and there were problems. So, I...
Read more >
null is not an object (evaluating 'rnfsmanager.rnfsfiletyperegular')
In case of iOS message is 'Native module cannot be null', In Android message is 'null is not an object evaluating RNFSManager etc'....
Read more >
react-native-community/async-storage - npm
An asynchronous, unencrypted, persistent, key-value storage system for React Native. Supported platforms. iOS; Android; Web · MacOS · Windows ...
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.
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