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 1,311 times
5
-
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
1 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
- 188
- 2
- 14
-
The option 'android.enableR8' is deprecated. It was removed in version 7.0 of the Android Gradle plugin. Please remove it from `gradle.properties`. – Martin Zeitler Jan 08 '22 at 13:58