React Native 0.57.1 Android Duplicate Resources React Native 0.57.1 Android Duplicate Resources android android

React Native 0.57.1 Android Duplicate Resources


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 Orrun react-native run-android --variant=release

Happy Coding..


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


Recent versions of React Native (>0.57.0) have increased the Gradle wrapper level to 4.4 and Gradle plugin to 3.1.4, as indicated by the changelog. This has the effect of making the Gradle build process store the results of AAPT, which are now required, within a different directory than previously.So basically you have to edit the /node_modules/react-native/react.gradle fileand add the doLast right after the doFirst block, manually.

doFirst { ... }doLast {    def moveFunc = { resSuffix ->        File originalDir = file("$buildDir/generated/res/react/release/drawable-${resSuffix}");        if (originalDir.exists()) {            File destDir = file("$buildDir/../src/main/res/drawable-${resSuffix}");            ant.move(file: originalDir, tofile: destDir);        }    }    moveFunc.curry("ldpi").call()    moveFunc.curry("mdpi").call()    moveFunc.curry("hdpi").call()    moveFunc.curry("xhdpi").call()    moveFunc.curry("xxhdpi").call()    moveFunc.curry("xxxhdpi").call()}