Home > Software design >  Why proGuard doesn't work when its active?
Why proGuard doesn't work when its active?

Time:03-02

I want to reduce my app size. I saw some tutorials and understood that I have to use the following code in build.gradle(app) :

buildTypes {
    release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
}

I tried it but the app size didn't change until I added another code and it worked :

buildTypes {
    release {
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
    }
    debug {
        debuggable true
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
    }
}

My question is why it should be use debug because it wasn't used in tutorials I saw.

I'm worried about slow app with this way.

Note : My Android Studio version is 3.5 and my gradle version is 7.0.4.

CodePudding user response:

An Android Studio project default buildtype is debug, you can see it on "Build Variants" panel on left bottom corner of Android Studio. You can also change it to release

  • Related