Reputation: 5325
I use Android Studio 3.3 Canary 5, Gradle 4.9, gradle plugin 3.3.0-alpha05
minifyEnabled true
useProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
Does't work.
Edit:
@JakeWharton: "You use ProGuard configurations for this, not a Gradle DSL. Disable shrinking with -dontshrink, disable obfuscation with -dontobfuscate, and disable optimization with -dontoptimize."
proguard-rules.pro
-dontshrink
-dontobfuscate
-dontoptimize
Upvotes: 30
Views: 26748
Reputation: 2341
build.gradle
buildTypes {
release {
shrinkResources false
minifyEnabled true // R8 or ProGuard will be enabled.
proguardFiles 'proguard-rules.pro'
}
debug {
shrinkResources false
minifyEnabled false // R8 or ProGuard will be disabled.
}
}
This answer does not demonstrate how to disable obfuscation within R8. It instead shows how to disable obfuscation at the build level.
I found setting minifyEnabled
to false in build.gradle
disables R8 and thus removes obfuscation. Obligatory reminder: Be cautious disabling obfuscation as it will mean the source will not be cloaked whatsoever.
Upvotes: 0
Reputation: 401
In your gradle.properties
file, add this line
android.enableR8=false
This worked for me.
Upvotes: 18
Reputation: 685
Following this answer, 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.
Upvotes: 25