Command failed: gradlew.bat installDebug

前端 未结 8 2235
太阳男子
太阳男子 2020-12-11 06:50

While developing an app I came into following error. I tried downgrading the java version from 11 to 8, but that wasn\'t helpful.

FAILURE: Build failed with          


        
8条回答
  •  遥遥无期
    2020-12-11 07:30

    Try running this command inside your project file

    react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res 
    

    after that

    cd (path to project/android folder) && gradlew clean && cd .. && react-native run-android
    

    always gradlew clean before run react-native-run-android the above command basically cleans up the gradle and previous builds.

    for ENOENT Error Check if $ yarn start works. The metro bundler wasn't able to run on port 8081 for me and I needed to run $ killall node

    EDIT:

    Also update the gradle-wrapper.properties add

    distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-all.zip

    remove following code from build.gradle:

    task wrapper(type: Wrapper) {
       gradleVersion = '5.2.1'
       distributionUrl = distributionUrl.replace("bin", "all")
    }
    

    after that

    cd (path to project/android folder) && gradlew clean && cd .. && react-native run-android
    

    always gradlew clean before run react-native-run-android the above command basically cleans up the gradle and previous builds.

    You're good to go!

提交回复
热议问题