I recently upgraded to Android Studio 3
gradle plugin: 3.0.0-beta2
gradle: 4.1
In our project we use: "react-native": "0.46.4" with the codepush plugin.
Building:
gradlew assembleStagingDebug
works just fine, but as soon as I try to build production:
gradlew assembleProductionRelease
I get an error caused by resources that are created by react in the processProductinoReleaseResources task:
Issues:
- ERROR: /Users/user/react/android/app/build/intermediates/res/merged/production/release/drawable-hdpi/node_modules_reactnavigation_src_views_assets_backicon.png uncompiled PNG file passed as argument. Must be compiled first into .flat file.
- ERROR: failed parsing overlays
at com.android.builder.internal.aapt.v2.AaptV2Jni.buildException(AaptV2Jni.java:154)
In my conquest against this issue I tried it with disabling proguard like:
buildTypes {
release {
debuggable true
minifyEnabled false
shrinkResources false
}
debug {
debuggable true
minifyEnabled false
println proguardFiles
}
}
But without any luck.
Any ideas? I would also appreciate an explanation of where this .flat conversion of the android resources happens what it actually does and why it does not happen during the StagingDebug task.
The workaround presented here worked for me in the end. But the original issue persists i think.
update 28.3.2018 Since Android studio 3.1 upgrade I get this:
WARNING: The option 'android.enableAapt2' is deprecated and should not be used anymore. Use 'android.enableAapt2=true' to remove this warning. It will be removed at the end of 2018
Since the issues on the react page are closed, I am looking for alternatives before they deprecate that workaround.
I faced a similar issue in my app. It is resolved by Go to "Android" directory and run