patch-package --- a/node_modules/react-native/react.gradle +++ b/node_modules/react-native/react.gradle @@ -41,6 +41,24 @@ afterEvaluate { resourcesDir.mkdirs() } + // From https://stackoverflow.com/questions/53239705/react-native-error-duplicate-resources-android + // Currently has no solution, and does not seem to affect Linux, but affects macOS release builds + 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