Gradle : DSL element 'useProguard' is obsolete and will be removed soon
Removing "useProguard" from build.gradle fixed the problem for me, like:
release {
minifyEnabled true
//useProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
Update 2022, or Details; R8
is nowadays:
- By default enabled,
- And it simply replaces
ProGuard
,But supports existing
.pro
files (and there should be no need to reconfigure). - Also, any way to disable R8, or use
ProGuard
instead, is deprecated (or even removed).But debug flavors can set
debuggable true
, and continue to be debuggable line-by-line.
set the following in your project's gradle.properties file
android.enableR8=true
R8 also has full mode that is not directly compatible with Proguard. In order to try that out you can additionally set the following in your gradle.properties file
android.enableR8.fullMode=true
This turns on more optimizations, that can further reduce app size. However, you might need a few extra keep rules to make it work.