2

I recently updated my gradle plugin, after that I was not allowed to use android.enableR8=false under my gradle.properties file. I want to disable the R8 in my app while keeping the latest gradle plugin version.

I'm facing the below error logs, which tells to remove android.enableR8=false from gradle.properties, after removing it my app works fine, however my release app have issues due to the R8 obfuscate, I want to disable the R8.

Caused by: com.android.builder.errors.EvalIssueException: The option 'android.enableR8' is deprecated.
It was removed in version 7.0 of the Android Gradle plugin.
Please remove it from `gradle.properties`.

Links I already tried:
https://developer.android.com/studio/build/shrink-code#configuration-files
https://developer.android.com/studio/build/shrink-code#troubleshoot
HAXM
  • 3,578
  • 4
  • 31
  • 38
  • 1
    It seems that [this commit](https://cs.android.com/android-studio/platform/tools/base/+/e1517675a3a392a26e3dcb60ab9e2541c91073ad) removed the option to disable R8. It says: `This change removes "android.enableR8=false" option from AGP, and only R8 can be used as code shrinker.` It introduced a temporary internal `unsafe.android.enableR8` flag, which was later [removed as well](https://cs.android.com/android-studio/platform/tools/base/+/6b49bbec1aa9b018b07476ace061f1409000ec7b). – Alex Lipov Feb 15 '22 at 21:24
  • thamks!, iss there any ssolution to disable R8 with gradle plugin 7.0 or above. – HAXM Feb 16 '22 at 16:53
  • Again, it seems that AGP 7 (and later) works only with R8. If you don't want to obfuscate/minify your app, why not just set `minifyEnabled false` in your release config? – Alex Lipov Feb 16 '22 at 17:09
  • I agree that `minifyEnabled false` is the way to go if you don't want any shrinking. If you where using `android.enableR8=false` to use ProGuard for shrinking see https://www.guardsquare.com/blog/using-proguard-with-the-android-gradle-plugin on how to keep using ProGuard. – sgjesse Feb 21 '22 at 14:54

2 Answers2

0

Android Gradle plugin 3.3.0 and is now enabled by default for both app and Android library projects using plugin 3.4.0 and higher.

for Gradle 3.4.0 and higher use the below code to disable R8 that is enables by default:

build.gradle (project level)

 buildTypes {
    release {
        minifyEnabled false  // set this to false!
Araz
  • 151
  • 2
  • 11
-2

Initially it is false. So just delete that line. Hope it will run and wont give any error. Do not make false, delete the line from gradle.prepertis

android.useAndroidX=true
android.enableJetifier=true
kotlin.code.style=official

and add these three line if not there.