From 1f8bac8276f747e8f68a51f0915fd373764758b3 Mon Sep 17 00:00:00 2001 From: serso Date: Tue, 27 Jan 2015 12:38:47 +0100 Subject: [PATCH] Now classes.dex is too big for running on Android 2.3 devices, let's minimize the code after compilation --- android-app/build.gradle | 4 + android-app/proguard-debug.cfg | 130 +++++++++++++++++++++++++++++++++ android-app/proguard.cfg | 1 + 3 files changed, 135 insertions(+) create mode 100644 android-app/proguard-debug.cfg diff --git a/android-app/build.gradle b/android-app/build.gradle index e516d32b..b364887a 100644 --- a/android-app/build.gradle +++ b/android-app/build.gradle @@ -39,6 +39,10 @@ android { proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard.cfg' zipAlignEnabled true } + debug { + minifyEnabled true + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-debug.cfg' + } } lintOptions { abortOnError false diff --git a/android-app/proguard-debug.cfg b/android-app/proguard-debug.cfg new file mode 100644 index 00000000..62cd3f66 --- /dev/null +++ b/android-app/proguard-debug.cfg @@ -0,0 +1,130 @@ +-target 1.6 +-dontobfuscate +-dontusemixedcaseclassnames +-dontskipnonpubliclibraryclasses +-dontpreverify +-repackageclasses '' +-allowaccessmodification +-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*,!code/allocation/variable +-keepattributes *Annotation* + +-keep public class * extends android.app.Activity +-keep public class * extends android.app.Application +-keep public class * extends android.app.Service +-keep public class * extends android.content.BroadcastReceiver +-keep public class * extends android.content.ContentProvider + +-keep public class * extends android.view.View { + public (android.content.Context); + public (android.content.Context, android.util.AttributeSet); + public (android.content.Context, android.util.AttributeSet, int); + public void set*(...); +} + +-keepclasseswithmembers class * { + public (android.content.Context, android.util.AttributeSet); +} + +-keepclasseswithmembers class * { + public (android.content.Context, android.util.AttributeSet, int); +} + +-keepclassmembers class * extends android.content.Context { + public void *(android.view.View); + public void *(android.view.MenuItem); +} + +-keepclassmembers class * implements android.os.Parcelable { + static android.os.Parcelable$Creator CREATOR; +} + +-keepclassmembers class **.R$* { + public static ; +} + +-keepclassmembers enum * { + public static **[] values(); + public static ** valueOf(java.lang.String); +} + +-keep @org.simpleframework.xml.Root public class * { + *; +} + +-dontwarn javax.xml.stream.** +-dontwarn com.bea.xml.stream.** +-dontwarn sun.misc.Unsafe +-dontwarn android.annotation.TargetApi +-dontwarn org.solovyev.common.math.visualisation.** +-dontwarn org.solovyev.common.math.graph.** +-dontwarn org.solovyev.common.math.algorithms.** +-dontwarn org.solovyev.common.drawing.** +-dontwarn org.joda.** +-dontwarn jscl.mathml.** +-dontwarn com.google.common.collect.MinMaxPriorityQueue +-dontwarn com.google.ads.** +-dontwarn com.sun.org.apache.xerces.internal.impl.dv.util.Base64 +-dontwarn com.actionbarsherlock.BuildConfig +-dontwarn com.google.android.gms.** +-dontwarn com.melnykov.fab.** + +-keep class org.simpleframework.xml.** { *; } +-keep class * implements org.solovyev.android.calculator.model.MathPersistenceEntity +-keep class * implements org.solovyev.android.calculator.MathEntityPersistenceContainer + +# +#********************************************************************* +# +# SHERLOCK +# +#********************************************************************* +# + +-keep class android.support.v4.app.** { *; } +-keep interface android.support.v4.app.** { *; } +-keep class com.actionbarsherlock.** { *; } +-keep interface com.actionbarsherlock.** { *; } + + +# +#********************************************************************* +# +# ACRA +# +#********************************************************************* +# + +# we need line numbers in our stack traces otherwise they are pretty useless +-renamesourcefileattribute SourceFile +-keepattributes SourceFile,LineNumberTable + +# ACRA needs "annotations" so add this... +-keepattributes *Annotation* + +# keep this class so that logging will show 'ACRA' and not a obfuscated name like 'a'. +# Note: if you are removing log messages elsewhere in this file then this isn't necessary +-keep class org.acra.ACRA { + *; +} + +-keep class org.acra.ReportField { + *; +} + + +# keep this around for some enums that ACRA needs +-keep class org.acra.ReportingInteractionMode { + *; +} + +# keep this otherwise it is removed by ProGuard +-keep public class org.acra.ErrorReporter +{ +public void addCustomData(java.lang.String,java.lang.String); +} + +# keep this otherwise it is removed by ProGuard +-keep public class org.acra.ErrorReporter +{ +public org.acra.ErrorReporter$ReportsSenderWorker handleSilentException(java.lang.Throwable); +} diff --git a/android-app/proguard.cfg b/android-app/proguard.cfg index c0759494..ebae0859 100644 --- a/android-app/proguard.cfg +++ b/android-app/proguard.cfg @@ -65,6 +65,7 @@ -dontwarn com.sun.org.apache.xerces.internal.impl.dv.util.Base64 -dontwarn com.actionbarsherlock.BuildConfig -dontwarn com.google.android.gms.** +-dontwarn com.melnykov.fab.** -keep class org.simpleframework.xml.** { *; } -keep class * implements org.solovyev.android.calculator.model.MathPersistenceEntity