Disable R8 in android app with gradle plugin 7.0 and above

6k Views Asked by At

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
2

There are 2 best solutions below

1
Fakhrul Siddiqei On

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.

0
Araz On

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!