AlexVPerl
AlexVPerl

Reputation: 7996

Android Studio Always Using Proguard & Obfuscating Debug Build - Unable To Debug

Using latest version of Android Studio 3.4.1 - and it seems that Android Studio is always using ProGuard even though I am setting useProguard false

    debug {
        debuggable true
        minifyEnabled true
        shrinkResources false
        useProguard false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
    }

This results in inability to debug and breakpoints not being hit as code is obfuscated.

useProguard false flag does not seem to work or do anything.

Is this a bug? Does anyone know how to resolve ?

Upvotes: 1

Views: 1998

Answers (1)

Myk Willis
Myk Willis

Reputation: 12879

According to the documentation, the minifyEnabled option will enable "code shrinking, obfuscation, and optimization" (emphasis mine).

If you want to minimize but not obfuscate your debug build, you probably want to leave proguard enabled, but add the -dontobfuscate option to your proguard-rules.txt file. Or, more likely, create a proguard-rules-debug.txt that contains -dontobfuscate, and refer to that file from the debug section of your build.gradle.

Upvotes: 1

Related Questions