Reputation: 5498
Title sums it up - my app is the same size installed on the device with and without Proguard and the APK is the same size on disk. I unzipped the APK and the dex files account for about 72% of it, so minifying should have a significant effect (unless I'm using every class and method from every dependency I've included, which is not plausible). I'm using the standard rules file plus one of my own with a few keep rules.
Gradle file:
release {
signingConfig signingConfigs.release
zipAlignEnabled true
minifyEnabled true
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
proguard-rules.pro
:
-dontwarn retrofit.**
-keep class retrofit.** { *; }
-keepattributes Signature
-keepattributes Exceptions
I thought there would be a ton of information about this problem but as far as I can tell there's almost nothing.
Upvotes: 3
Views: 1172
Reputation: 152817
Use proguard-android-optimize.txt
and not proguard-android.txt
as the base proguard config file.
The first one configures both obfuscation and optimization while the latter configures only obfuscation.
Upvotes: 0
Reputation: 103
minifyEnabled true
: it runs ProGuard
shrinkResources true
: it removes resources that ProGuard flagged as unused.
While removing unwanted files from your DEX, your APK size also reduces.
Upvotes: 2