简体   繁体   中英

Execution failed for task ':amazon-cognito-identity-js:javaPreCompileDebug'

I'm having this error when I try running the app with "npm run android". Everything was working perfectly until this happened. Here's the build log:

`

> DriverApp@0.0.1 android
> react-native run-android

info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 1256 file(s) to forward-jetify. Using 8 workers...
info JS server already running.
info Installing the app...
> Task :amazon-cognito-identity-js:javaPreCompileDebug FAILED                                                                                                                                        

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.                                                                                                          
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.2/userguide/command_line_interface.html#sec:command_line_warnings
8 actionable tasks: 8 executed

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':amazon-cognito-identity-js:javaPreCompileDebug'.
> Could not resolve all files for configuration ':amazon-cognito-identity-js:debugCompileClasspath'.
   > Failed to transform react-native-0.71.0-rc.0-debug.aar (com.facebook.react:react-native:0.71.0-rc.0) to match attributes {artifactType=android-classes, com.android.build.api.attributes.BuildTypeAttr=debug, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.libraryelements=aar, org.gradle.status=release, org.gradle.usage=java-api}.
      > Execution failed for JetifyTransform: C:\Users\x\.gradle\caches\modules-2\files-2.1\com.facebook.react\react-native\0.71.0-rc.0\x\react-native-0.71.0-rc.0-debug.aar.
         > Java heap space

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 14s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.        
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081

`

And here's my package.json file:

{

  "dependencies": {
    "@react-native-community/geolocation": "^2.0.2",
    "@react-native-community/masked-view": "^0.1.10",
    "@react-native-community/netinfo": "^5.9.10",
    "@react-native-community/slider": "^4.2.3",
    "@react-native-picker/picker": "^2.4.1",
    "@react-navigation/drawer": "^5.12.3",
    "@react-navigation/native": "^5.9.2",
    "@react-navigation/stack": "^5.14.2",
    "amazon-cognito-identity-js": "^4.5.10",
    "aws-amplify": "^3.3.18",
    "aws-amplify-react-native": "^4.3.1",
    "react": "16.13.1",
    "react-native": "0.63.4",
    "react-native-camera": "^4.2.1",
    "react-native-geolocation-service": "^5.3.0-beta.4",
    "react-native-gesture-handler": "^1.9.0",
    "react-native-google-places-autocomplete": "^2.1.2",
    "react-native-image-picker": "^4.10.0",
    "react-native-maps": "0.27.1",
    "react-native-maps-directions": "^1.8.0",
    "react-native-material-cards": "^1.0.16",
    "react-native-reanimated": "^1.13.2",
    "react-native-safe-area-context": "^3.1.9",
    "react-native-screens": "^2.17.1",
    "react-native-vector-icons": "^7.1.0",
    "rn-qr-generator": "^1.2.0"
  },
  "devDependencies": {
    "@babel/core": "^7.8.4",
    "@babel/runtime": "^7.8.4",
    "@react-native-community/eslint-config": "^1.1.0",
    "@types/react-native": "~0.67.6",
    "babel-jest": "^25.1.0",
    "eslint": "^6.5.1",
    "jest": "^28.1.3",
    "metro-react-native-babel-preset": "^0.59.0",
    "react-test-renderer": "16.13.1"
  },

}

I just tried to build my react native app as usual but it won't build due to this problem which I think is coming from AWS Cognito dose anyone had the same issue and managed to solve it, please?

This is related to RN release 0.71.0-rc0. Check here for fix and more info.

I found the answer to this question here:

React Native Android build failure with different errors without any changes in code for past days due to publish of React Native version 0.71.0-rc.0

After I updated my android/build.gradle file as follows it worked perfectly:

buildscript {
    // ...
}


allprojects {
    repositories {
       exclusiveContent {
           filter {
               includeGroup "com.facebook.react"
           }
           forRepository {
               maven {
                   url "$rootDir/../node_modules/react-native/android"
               }
           }
       }
        // ...
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM