async-storage: RN 0.60.0 error: package com.facebook.react.module.annotations does not exist

upgrading to react-native 0.60.0 throw this error:


xx/node_modules/@react-native-community/async-storage/android/src/main/java/com/reactnativecommunity/asyncstorage/AsyncStorageModule.java:26: error: package com.facebook.react.module.annotations does not exist
import com.facebook.react.module.annotations.ReactModule;
                                            ^
xx/node_modules/@react-native-community/async-storage/android/src/main/java/com/reactnativecommunity/asyncstorage/AsyncStorageModule.java:33: error: cannot find symbol
@ReactModule(name = AsyncStorageModule.NAME)
 ^
  symbol: class ReactModule
2 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':@react-native-community_async-storage:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

BUILD FAILED in 24s

    at checkExecSyncError (child_process.js:637:11)
    at execFileSync (child_process.js:655:13)
    at runOnAllDevices (xx/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:75:39)
    at buildAndRun (xx/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js:137:41)
    at then.result (xx/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js:103:12)
    at processTicksAndRejections (internal/process/next_tick.js:81:5)
  • Async Storage version: 1.5.0
  • React-Native version: 0.60.0

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 16 (2 by maintainers)

Commits related to this issue

Most upvoted comments

@AbanoubNassem in my case adding:

maven { // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm url “$rootDir/…/node_modules/react-native/android” }

to the allprojects config worked

I’m getting this error, react native 0.61.0-rc.0. Any update on this ?

For monorepo projects, don’t forget to adjust these paths according to your folder structure.

For me, setting it to url “$rootDir/…/…/…/…/node_modules/react-native/android” solved my problem.

@AbanoubNassem in my case adding:

maven { // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm url “$rootDir/…/node_modules/react-native/android” }

to the allprojects config worked

Try these steps:

  1. Make sure that react-native is in app/build.gradle dependencies
  2. Run ./gradlew clean in android/ directory
  3. Remove node_modules
  4. Install node modules
  5. Run react-native run-android in your project root

I am having this same problem. Removing the package, and adding it back and the latest version to an existing application that had it prior to the .60 update.

after removing/adding all my current packages and upgrading it to use Androidx , I saw that I have native-navigation package https://github.com/airbnb/native-navigation#readme I have no clue how this package was added! probably typeo when instantiated the project back then. I didn’t have this issue before since I was adding the plugins manually, but since v 0.60 the new CLI introduced the auto-discovery function , hence discovering this old package making the whole app crash.

hope this might help someone , if they faced similar problem

hello @Krizzu , when I tested it on a fresh app it worked fine, but it errors out in my current app, so am trying to figure out which package is conflicting with , and I will update you once I figure something out