mercredi 25 janvier 2017

Proguard not shrinking test APK

I'm using Proguard to shrink my debug apk and test apk

buildTypes {
    debug {
        applicationIdSuffix ".debug"
        debuggable true
        signingConfig signingConfigs.debug
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        testProguardFile 'proguard-test-rules.pro'
    }

When I enable minify and run integration tests, the debug apk method count reduces, but not the test apk.

I know that Proguard is doing something, because if I don't have the right rules in proguard-test-rules.pro I'll see warnings and the test apk won't compile.

So what's happening? Why isn't my test apk shrinking? Just for reference, here are my .pro files:

proguard-rules.pro:

# general
-dontobfuscate

# for Retrofit2
-dontwarn retrofit2.**
-keep class retrofit2.** { *; }
-keepattributes Signature
-keepattributes Exceptions

# for RetroLambda
-dontwarn java.lang.invoke.*

# for Saripaar
-keep class com.mobsandgeeks.saripaar.** {*;}
-keep @com.mobsandgeeks.saripaar.annotation.ValidateUsing class * {*;}

# for OKIO
-dontwarn okio.**

# for RxJava
-dontwarn sun.misc.Unsafe

# for android.content.res classes
-dontwarn org.xmlpull.v1.**

# for Butterknife
-dontwarn rx.functions.Func1

proguard-test-rules.pro

-include proguard-rules.pro

-dontobfuscate
-dontwarn

-dontwarn org.hamcrest.**
-dontwarn android.test.**

-dontwarn android.support.test.**
-keep class android.support.test.** { *; }

-keep class junit.runner.** { *; }
-keep class junit.framework.** { *; }
-keep class org.jmock.core.** { *; }
-keep class org.easymock.** { *; }


-dontwarn com.fasterxml.jackson.databind.**
-dontwarn com.fasterxml.jackson.core.**
-dontwarn com.fasterxml.jackson.annotation.**
-dontwarn org.ietf.jgss.**
-dontwarn javax.xml.**
-dontwarn javax.swing.**
-dontwarn javax.lang.**
-dontwarn java.nio.**
-dontwarn java.lang.**
-dontwarn org.w3c.dom.traversal.**
-dontwarn org.eclipse.jetty.**
-dontwarn java.beans.**
-dontwarn org.slf4j.**
-dontwarn org.apache.http.**

Aucun commentaire:

Enregistrer un commentaire