React Native 0.57.1 Android Duplicate Resources

前端 未结 10 991
离开以前
离开以前 2020-12-05 09:41

When running ./android/gradlew assembleRelease I get the following error:

``` * What went wrong: Execution failed for task \':app:mergeReleaseResources\

相关标签:
10条回答
  • 2020-12-05 10:22

    Go to the android/app/src/res/ path and then delete all the drawable-hdpi, mdpi, xhdpi, xxhdpi, xxxhdpi, raw folders.

    0 讨论(0)
  • 2020-12-05 10:25

    remove all files that have names like node_modules_{some_path}_{imagename}.{extension} or src_images_{imagename}.{extension}

    from all the folders in android/app/src/main/res, e.g.

    android/app/src/main/res/drawable-xhdpi/node_modules_reactnavigation_src_views_assets_backicon.png android/app/src/main/res/drawable-xhdpi/src_images_mylogo.jpg

    The probably got put there by react-native bundle and they cause the duplicate resource error

    0 讨论(0)
  • 2020-12-05 10:27

    Had the same error. What I did to resolve it:

    1. delete all the pictures in the drawable folder android/app/src/main/res
    2. generate apk cd android && gradlew assembleRelease
    0 讨论(0)
  • 2020-12-05 10:29

    Here is the simple solution :

    1. Delete build inside android/app folder
    2. Delete build inside android folder
    3. run rm -rf $HOME/.gradle/caches/
    4. Open build.gradle --> android/app/build.gradle
    5. comment this line

    //apply from: "../../node_modules/react-native/react.gradle"

    1. Delete index.android.bundle file from assets folder and re-create using 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

    2. run react-native run-android Or run react-native run-android --variant=release

    Happy Coding..

    0 讨论(0)
提交回复
热议问题