React Native Duplicate Resources: Android

Source URL: https://stackoverflow.com/questions/53239705/react-native-error-duplicate-resources-android

Language: javascript

Created on: 2021-09-02 05:22:17

rm -rf ./android/app/src/main/res/drawable-*

rm -rf ./android/app/src/main/res/raw

OR

add following code to node_modules/react-native/react.gradle

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()
}
I was trying to create a release apk file from Android but when I create a release apk with PNG image I'm getting Duplicate Resource error. Initially I thought this is happening because I made a mi...
content_copy