Skip to content

Commit

Permalink
Fixed: [Android] Error: Duplicate resources #22234
Browse files Browse the repository at this point in the history
Fixed error "Duplicate resources" while building APK file in Android

"[drawable-.../...]/.../android/app/src/main/res/drawable-mdpi/FILE [drawable-.../...] /.../android/app/build/generated/res/react/release/drawable-mdpi-v4/FILE: Error: Duplicate resources"
  • Loading branch information
Ovi authored Mar 11, 2019
1 parent f741d33 commit e9a189e
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion react.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,22 @@ afterEvaluate {
resourcesDir.deleteDir()
resourcesDir.mkdirs()
}

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()
}

// Set up inputs and outputs so gradle can cache the result
inputs.files fileTree(dir: reactRoot, excludes: inputExcludes)
outputs.dir(jsBundleDir)
Expand Down

0 comments on commit e9a189e

Please sign in to comment.