Search code examples
androidgradleproguardandroid-r8

Gradle : DSL element 'useProguard' is obsolete and will be removed soon


Since the 3.5 update of Android Studio, I have this warning when building my app :

DSL element 'useProguard' is obsolete and will be removed soon. Use 'android.enableR8' in gradle.properties to switch between R8 and Proguard..


Solution

  • 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.