From fc603bedc6aff01e7c24c440d32e9df6750639e9 Mon Sep 17 00:00:00 2001 From: Nhan Cao Date: Wed, 7 Mar 2018 11:09:22 +0700 Subject: [PATCH] Fix android build release Fix error for android build release: Duplicate file, Original is here. The version qualifier may be implied Ref: https://medium.com/p/115e967c59e6 --- react.gradle | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/react.gradle b/react.gradle index 64b2f02f8cbf26..16692f53883c85 100644 --- a/react.gradle +++ b/react.gradle @@ -70,6 +70,23 @@ gradle.projectsEvaluated { resourcesDir.mkdirs() } + // Fix android build release error: "Duplicate file, Original is here" + doLast { + def moveFunc = { resSuffix -> + File originalDir = file("${resourcesDir}/drawable-${resSuffix}") + if (originalDir.exists()) { + File destDir = file("${resourcesDir}/drawable-${resSuffix}-v4") + 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