Home > database >  Execution failed for task ':@react-native-community_async-storage:compileDebugJavaWithJavac
Execution failed for task ':@react-native-community_async-storage:compileDebugJavaWithJavac

Time:11-11


Suddenly, my application is not running the debug. When I try to run: ``` npx react-native run-android ```

It seems that it stops when the first library is scanned (I am not sure if that is the world) to agregate the apk.

Task :@react-native-community_async-storage:compileDebugJavaWithJavac FAILED

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.

My package.json configuration:

"dependencies": {
    "@react-native-community/async-storage": "^1.12.1",
    "@react-native-community/netinfo": "8.3.0",
    "@react-native-firebase/analytics": "^15.6.0",
    "@react-native-firebase/app": "^15.6.0",
    "@react-native-firebase/auth": "^15.6.0",
    "@react-native-firebase/database": "^15.6.0",
    "@react-native-firebase/firestore": "^15.6.0",
    "@react-native-firebase/functions": "^15.6.0",
    "@react-native-firebase/messaging": "^15.6.0",
    "@react-native-firebase/remote-config": "^15.6.0",
    "@sentry/react-native": "3.4.3",
    "moment": "2.29.3",
    "react": "16.9.0",
    "react-native": "0.61.3",
    "react-native-calendars": "1.259.0",
    "react-native-code-push": "6.0.0",
    "react-native-extended-stylesheet": "^0.12.0",
    "react-native-fast-image": "^8.5.11",
    "react-native-fs": "^2.14.1",
    "react-native-image-picker": "^1.0.2",
    "react-native-keep-awake": "^4.0.0",
    "react-native-keychain": "^4.0.1",
    "react-native-masked-text": "^1.13.0",
    "react-native-push-notification": "^8.1.1",
    "react-native-vector-icons": "^5.0.0",
    "react-native-webview": "^7.4.1",
    "react-redux": "^8.0.2",
    "react-router": "^5.1.2",
    "react-router-dom": "^5.1.2",
    "react-router-native": "^5.1.2",
    "realm": "6.0.3",
    "redux": "^4.2.0",
    "redux-thunk": "^2.4.1"
  },

I've already tried to restart my computer, clean the gradle (cd android && ./gradle clean), clean gradle cash (rm -rf ~/.gradle/caches) , debug through (./gradlew assembleDebug --info). But i keep getting the same error. What should I do?

CodePudding user response:

since the last react native update this error occured, as per the documentation you need to add this in android/build.gradle

def REACT_NATIVE_VERSION = new File(['node', '--print',"JSON.parse(require('fs').readFileSync(require.resolve('react-native/package.json'), 'utf-8')).version"].execute(null, rootDir).text.trim())

allprojects {
 configurations.all {
    resolutionStrategy {
        force "com.facebook.react:react-native:"   REACT_NATIVE_VERSION
    }
 }
}
  • Related