Async-storage: [Android] Deprecated Gradle features making it incompatible with Gradle 6.0

Created on 17 Jun 2019  路  12Comments  路  Source: react-native-async-storage/async-storage

Current behavior

Task :@react-native-community_async-storage:generateDebugRFile
Changing the value for a property with a final value has been deprecated. This will fail with an error in Gradle 6.0.

Task :@react-native-community_async-storage:compileDebugJavaWithJavac FAILED
/Users/suraneti/cm-transit-app/node_modules/@react-native-community/async-storage/android/src/main/java/com/reactnativecommunity/asyncstorag
e/AsyncStorageModule.java:26: error: package com.facebook.react.module.annotations does not exist
import com.facebook.react.module.annotations.ReactModule;
^
/Users/suraneti/cm-transit-app/node_modules/@react-native-community/async-storage/android/src/main/java/com/reactnativecommunity/asyncstorag
e/AsyncStorageModule.java:33: error: cannot find symbol
@ReactModule(name = AsyncStorageModule.NAME)
^
symbol: class ReactModule
2 errors

FAILURE: Build failed with an exception.

Expected behavior

Run successful

Repro steps

npm install
react-native run-android

Environment

  • Async Storage version: 1.4.2
  • React-Native version: 0.59.9
  • Platform tested: Android (Worked fine on iOS)
  • Logs/Error that are relevant: -
Android

Most helpful comment

I think I had slightly different issue, but the error above was there too and what helped me was this

./gradlew clean
rm -rf ~/.gradle/caches/*

All 12 comments

Hi @suraneti,

Gradle 6.0 info is a warning. The real issue is reactnativecommunity/asyncstorag e/AsyncStorageModule.java:26: error: package com.facebook.react.module.annotations does not exist

Seems like your RN dependencies are not synced/added correctly. Try cleaning up your project/removing node_modules and install everything again.

@Krizzu after I've cleaned up gradle and re-install node_modules, problem seem to be solved now.

Im having this issue currently, cleaned gradel and reinstalled node_modules, any tips?

@MUllman here my RN info and library version, I still don't know what is root of this problem.

  • Async Storage version: 1.4.2

    React Native Environment Info:
    System:
      OS: macOS 10.14.5
      CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
      Memory: 8.21 GB / 16.00 GB
      Shell: 3.2.57 - /bin/bash
    Binaries:
      Node: 10.15.0 - /usr/local/bin/node
      Yarn: 1.13.0 - /usr/local/bin/yarn
      npm: 6.9.0 - /usr/local/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
      Android SDK:
        API Levels: 23, 24, 25, 26, 27, 28
        Build Tools: 26.0.1, 26.0.2, 27.0.3, 28.0.2, 28.0.3
        System Images: android-28 | Google APIs Intel x86 Atom, android-28 | Google Play Intel x86 Atom_64
    IDEs:
      Android Studio: 3.3 AI-182.5107.16.33.5199772
      Xcode: 10.2.1/10E1001 - /usr/bin/xcodebuild
    npmPackages:
      react: 16.8.3 => 16.8.3 
      react-native: 0.59.9 => 0.59.9 
    npmGlobalPackages:
      react-native-cli: 2.0.1
      react-native-git-upgrade: 0.2.7
      react-native-rename: 2.4.1
    

Check your app/build.gradle dependencies (if it has indeed RN dep), clean gradle and yarn caches, remove node_modules resync everything.

If you're working in android, remove .idea/modules and restart it.

Worked for me after I had been trying to debug the problem for several hours.

Further, try to also incorporate the step provided as a solution in this similar stackoverflow issue

Solution doesn't work on my app @Krizzu

Tried:

  • rm -rf node_modules
  • clean gradle
  • npm i
  • npm start -- --reset-cache
  • unlink and link module

Issue still appears
AsyncStorageModule: error: package com.facebook.react.module.annotations does not exist

@wkwyatt maybe your RN < 0.60 and some library required RN >= 0.60

can you provide your package.json?

I think I had slightly different issue, but the error above was there too and what helped me was this

./gradlew clean
rm -rf ~/.gradle/caches/*

./gradlew clean is OKAY

react-native-android-error
After removing .gradle folder and build folder inside android folder of react native project, everything is work for me.

react-native-android-error
After removing .gradle folder and build folder inside android folder of react native project, everything is work for me.

It is ok for me!!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bernhardt1 picture bernhardt1  路  7Comments

MwareSolutons picture MwareSolutons  路  7Comments

Riant picture Riant  路  4Comments

frankenthumbs picture frankenthumbs  路  6Comments

codecog picture codecog  路  4Comments