When I am trying to generate android apk by using ./gradlew installRelease
, I get this error in console:
~/React-Native/mockingbird/android/app/
For me it work to remove the folder: android/build
and run ./gradlew assembleRelease
again.
In order to get my build working for React Native 0.57.5, I used Mapsy's answer with a minor enhancement. I needed to be able to build for multiple flavors and generally I try to avoid hardcoding things. When looking through my react.gradle
file, I found it had the following variable defined:
def resourcesDir = file("$buildDir/generated/res/react/${targetPath}")
So instead of hardcoding the build type/flavor in the path like this:
File originalDir = file("$buildDir/generated/res/react/release/drawable-${resSuffix}");
I instead used the resourcesDir
variable to set the originalDir
path like this:
File originalDir = file("${resourcesDir}/drawable-${resSuffix}");
As a result, my doLast
looks like this:
doLast {
def moveFunc = { resSuffix ->
File originalDir = file("${resourcesDir}/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()
}