I want to disable R8 for a specific flavor of my app (so setting android.enableR8=false). Does anybody know how to do it, or if it is even possible? Can I maybe somehow have designated gradle.properties files, or how would that work?
Asked
Active
Viewed 533 times
3
-
Try This Link : [enter link description here](https://stackoverflow.com/a/43329997/12419420) – Nov 23 '19 at 10:45
-
I find a far easier solution Try This Link of : https://stackoverflow.com/a/43329997/12419420 – Nov 23 '19 at 10:48
-
Background info for others (and why I ended up here): this is likely needed due to this problem with Amazon IAP with R8 enabled with Gradle 3.4.0): https://developer.amazon.com/docs/in-app-purchasing/iap-obfuscate-the-code.html – mm2001 Feb 06 '20 at 02:02
2 Answers
1
I now solved this problem by passing the parameter from command line. This overrides the setting in gradle.properties. Since I have a script at hand that creates a release build for a specific flavor this works well. Depending on the flavor I pass either:
./gradlew -P android.enableR8=false assemble[...]Release
or
./gradlew -P android.enableR8=true assemble[...]Release
This does the trick for me now :)
Tim Strehlow
- 168
- 13
0
I was able to solve this issue. Instead of editing the build.gradle
file, I added -dontobfuscate
to the proguard-rules.pro
file. (You can configure a different proguard
rules file for debug and release builds.) This skipped the obfuscation step and allowed me to make shrink'd debug builds with R8.
R.Desai
- 1,112
- 4
- 16
-
1Thank you for your answer, but unfortunately that won't work for me. I need to disable R8 totally for a specific product flavor, but keep it for others. – Tim Strehlow Nov 22 '19 at 13:24