My ProGuard Configuration Base File
1 min read

My ProGuard Configuration Base File

My ProGuard Configuration Base File

Following my previous proguard entry, I think it's useful to present my final proguard configuration. I'm starting with my base file (, explaining it along the way (as much as I can understand).

Proguard Set-up

I have a normal project structure (<fallpaper>/<app>), and my proguard is configured in <fallpaper>/<app>/build.gradle. The confgiration sequence in my gradle file is:

buildTypes {
    debug {
        applicationIdSuffix ".dev"
        versionNameSuffix '-dev'

        debuggable true
        signingConfig signingConfigs.debug
    release {
        debuggable false
        minifyEnabled true
        signingConfig signingConfigs.release
        proguardFiles getDefaultProguardFile('proguard-android.txt'), ''

Proguard Configuration

I'm starting by enabling some global flags in my file:

-optimizationpasses 5
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*,!code/allocation/variable

I'm not using the obfuscation yet because it's silly hard to get it right with some 3rd party libraries. However, I'm using optimisations and I want it verbose.

Next, I'm saving some interesting data (most notably the unused stuff):

# Print stuff
-printseeds ../build/proguard_seeds.txt
-printusage ../build/proguard_unused.txt
-printmapping ../build/proguard_mapping.txt

Currently, gradle creates build directories at both levels, so I'm saving the files in the root build/ directory.

Lastly, I have a list of included files, one for each library used (as noted in my previous post):

-include proguard-com.jakewarthon.butterknife.txt
-include proguard-com.squareup.retrofit.txt
-include proguard-com.squareup.dagger.txt
-include ../dagger-proguard-keepnames.cfg
-include proguard-com.mixpanel.txt
-include proguard-com.fasterxml.jackson.txt

Note that ../dagger-proguard-keepnames.cfg is generted by dagger proguard helper plugin.

The base file is ready now.