diff --git a/build.gradle b/build.gradle index 36ea316f6..4c8e4b316 100644 --- a/build.gradle +++ b/build.gradle @@ -157,11 +157,31 @@ android { buildTypes { debug { minifyEnabled true - proguardFiles 'proguard.cfg' + proguardFiles getDefaultProguardFile('proguard-android.txt'), + 'proguard-google-play-services.pro', + 'proguard-dagger.pro', + 'proguard-jackson.pro', + 'proguard-sqlite.pro', + 'proguard-appcompat-v7.pro', + 'proguard-square-okhttp.pro', + 'proguard-square-okio.pro', + 'proguard-spongycastle.pro', + 'proguard-rounded-image-view.pro', + 'proguard.cfg' } release { minifyEnabled true - proguardFiles 'proguard.cfg' + proguardFiles getDefaultProguardFile('proguard-android.txt'), + 'proguard-google-play-services.pro', + 'proguard-dagger.pro', + 'proguard-jackson.pro', + 'proguard-sqlite.pro', + 'proguard-appcompat-v7.pro', + 'proguard-square-okhttp.pro', + 'proguard-square-okio.pro', + 'proguard-spongycastle.pro', + 'proguard-rounded-image-view.pro', + 'proguard.cfg' signingConfig signingConfigs.release } } diff --git a/proguard-appcompat-v7.pro b/proguard-appcompat-v7.pro new file mode 100644 index 000000000..4d1f32881 --- /dev/null +++ b/proguard-appcompat-v7.pro @@ -0,0 +1,8 @@ +-keep public class android.support.v7.widget.** { *; } +-keep public class android.support.v7.internal.widget.** { *; } +# below line disabled due to LGE ROM bug. +# -keep public class android.support.v7.internal.view.menu.** { *; } + +-keep public class * extends android.support.v4.view.ActionProvider { + public (android.content.Context); +} \ No newline at end of file diff --git a/proguard-dagger.pro b/proguard-dagger.pro new file mode 100644 index 000000000..8e1e5e4ab --- /dev/null +++ b/proguard-dagger.pro @@ -0,0 +1,20 @@ +-keepattributes *Annotation*,EnclosingMethod +-keep @interface dagger.*,javax.inject.* +-keep @dagger.Module class * +-keepclassmembers class * { + @javax.inject.* *; + @dagger.* *; + (); +} +-keepclasseswithmembernames class * { + @javax.inject.* ; +} +-keep class javax.inject.** { *; } +-keep class **$$ModuleAdapter +-keep class **$$InjectAdapter +-keep class **$$StaticInjection + +-keep class dagger.** { *; } +-keep class * extends dagger.** { *; } +-keep interface dagger.** {*;} +-dontwarn dagger.internal.codegen.** diff --git a/proguard-google-play-services.pro b/proguard-google-play-services.pro new file mode 100644 index 000000000..ae70fc4e4 --- /dev/null +++ b/proguard-google-play-services.pro @@ -0,0 +1,19 @@ +## Google Play Services 4.3.23 specific rules ## +## https://developer.android.com/google/play-services/setup.html#Proguard ## + +-keep class * extends java.util.ListResourceBundle { + protected Object[][] getContents(); +} + +-keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable { + public static final *** NULL; +} + +-keepnames @com.google.android.gms.common.annotation.KeepName class * +-keepclassmembernames class * { + @com.google.android.gms.common.annotation.KeepName *; +} + +-keepnames class * implements android.os.Parcelable { + public static final ** CREATOR; +} \ No newline at end of file diff --git a/proguard-jackson.pro b/proguard-jackson.pro new file mode 100644 index 000000000..82f1593a7 --- /dev/null +++ b/proguard-jackson.pro @@ -0,0 +1,12 @@ +# Proguard configuration for Jackson 2.x (fasterxml package instead of codehaus package) + +-keepattributes *Annotation*,EnclosingMethod,Signature +-keepnames class com.fasterxml.jackson.** { +*; +} +-keepnames interface com.fasterxml.jackson.** { + *; +} +-dontwarn com.fasterxml.jackson.databind.** +-keep class org.codehaus.** { *; } + diff --git a/proguard-rounded-image-view.pro b/proguard-rounded-image-view.pro new file mode 100644 index 000000000..988e525da --- /dev/null +++ b/proguard-rounded-image-view.pro @@ -0,0 +1 @@ +-dontwarn com.squareup.picasso.** \ No newline at end of file diff --git a/proguard-spongycastle.pro b/proguard-spongycastle.pro new file mode 100644 index 000000000..935ce94fc --- /dev/null +++ b/proguard-spongycastle.pro @@ -0,0 +1,2 @@ +-keep class org.spongycastle.** {*;} +-dontwarn javax.naming.** \ No newline at end of file diff --git a/proguard-sqlite.pro b/proguard-sqlite.pro new file mode 100644 index 000000000..7660512e6 --- /dev/null +++ b/proguard-sqlite.pro @@ -0,0 +1,2 @@ +-keep class org.sqlite.** { *; } +-keep class org.sqlite.database.** { *; } \ No newline at end of file diff --git a/proguard-square-okhttp.pro b/proguard-square-okhttp.pro new file mode 100644 index 000000000..6b25daf64 --- /dev/null +++ b/proguard-square-okhttp.pro @@ -0,0 +1,6 @@ +# OkHttp +-keepattributes Signature +-keepattributes *Annotation* +-keep class com.squareup.okhttp.** { *; } +-keep interface com.squareup.okhttp.** { *; } +-dontwarn com.squareup.okhttp.** \ No newline at end of file diff --git a/proguard-square-okio.pro b/proguard-square-okio.pro new file mode 100644 index 000000000..589e679d9 --- /dev/null +++ b/proguard-square-okio.pro @@ -0,0 +1,5 @@ +# Okio +-keep class sun.misc.Unsafe { *; } +-dontwarn java.nio.file.* +-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement +-dontwarn okio.** \ No newline at end of file diff --git a/proguard.cfg b/proguard.cfg index c13f7bf4e..a2809723d 100644 --- a/proguard.cfg +++ b/proguard.cfg @@ -1,6 +1,3 @@ --keepattributes ** +-keep class org.whispersystems.** { *; } +-keep class org.thoughtcrime.securesms.** { *; } --keep class !com.afollestad.materialdialogs.**,!com.nineoldandroids.**,!org.spongycastle.crypto.tls.**,!com.doomonafireball.betterpickers.**,!org.w3c.**,!android.support.v7.internal.view.menu.**,!org.spongycastle.asn1.**,!org.spongycastle.crypto.ec.**,!org.spongycastle.x509.**,!org.spongycastle.crypto.agreement.**,!org.spongycastle.crypto.ec.**,!org.spongycastle.math.**,!org.spongycastle.pqc.**,!org.spongycastle.jcajce.provider.asymmetric.**,!org.apache.http.**,** {*;} --dontpreverify --dontoptimize --dontwarn **