diff --git a/app/build.gradle b/app/build.gradle index 37539c74e..662ea7073 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -273,6 +273,9 @@ android { // Release Type release { + minifyEnabled true + shrinkResources true + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' signingConfig signingConfigs.release buildConfigField "String", "KIWIX_DOWNLOAD_URL", "\"http://mirror.download.kiwix.org/\"" buildConfigField "boolean", "KIWIX_ERROR_ACTIVITY", "true" @@ -407,15 +410,6 @@ android { javaMaxHeapSize "4g" } - /* - Add back once proguard is configured - buildTypes { - release { - minifyEnabled true - proguardFiles getDefaultProguardFile("proguard-android.txt") - } - } - */ androidExtensions { experimental = true } diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro new file mode 100644 index 000000000..fbedbf4f3 --- /dev/null +++ b/app/proguard-rules.pro @@ -0,0 +1,37 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile + +######################## +# Kiwix specific rules # +######################## + +#keep everything in kiwixlib +-keep class org.kiwix.kiwixlib.** { *; } + +## SimpleXml +-dontwarn com.bea.xml.stream.** +-dontwarn org.simpleframework.xml.stream.** +-keep class org.simpleframework.xml.**{ *; } +-keepclassmembers,allowobfuscation class * { + @org.simpleframework.xml.* ; + @org.simpleframework.xml.* (...); +} diff --git a/proguard.cfg b/proguard.cfg deleted file mode 100644 index 454d60efd..000000000 --- a/proguard.cfg +++ /dev/null @@ -1,44 +0,0 @@ --optimizationpasses 5 --dontusemixedcaseclassnames --dontskipnonpubliclibraryclasses --dontpreverify --verbose --optimizations !code/simplification/arithmetic,!field/*,!class/merging/* - --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.app.backup.BackupAgentHelper --keep public class * extends android.preference.Preference --keep public class com.android.vending.licensing.ILicensingService - -# Allow obfuscation of android.support.v7.internal.view.menu.** -# to avoid problem on Samsung 4.2.2 devices with appcompat v21 -# see https://code.google.com/p/android/issues/detail?id=78377 --keep class !android.support.v7.internal.view.menu.**,android.support.** {*;} - --keepclasseswithmembers class * { - native ; -} - --keepclasseswithmembers class * { - public (android.content.Context, android.util.AttributeSet); -} - --keepclasseswithmembers class * { - public (android.content.Context, android.util.AttributeSet, int); -} - --keepclassmembers enum * { - public static **[] values(); - public static ** valueOf(java.lang.String); -} - --keep class * implements android.os.Parcelable { - public static final android.os.Parcelable$Creator *; -} - --keep class sun.misc.Unsafe { *; } --dontnote sun.misc.Unsafe