From 32614425e48a1fd86ca8674a04835c8c40e5594c Mon Sep 17 00:00:00 2001 From: David-Development Date: Thu, 20 Aug 2015 17:02:23 +0200 Subject: [PATCH] add proguard --- News-Android-App/build.gradle | 4 ++ News-Android-App/proguard-android.txt | 57 +++++++++++++++++++++++++++ News-Android-App/proguard-rules.txt | 44 ++++++++++++++++++++- 3 files changed, 104 insertions(+), 1 deletion(-) create mode 100644 News-Android-App/proguard-android.txt diff --git a/News-Android-App/build.gradle b/News-Android-App/build.gradle index 0e35ad6f..950dfe2a 100644 --- a/News-Android-App/build.gradle +++ b/News-Android-App/build.gradle @@ -10,6 +10,10 @@ android { } buildTypes { + debug { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' + } release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' diff --git a/News-Android-App/proguard-android.txt b/News-Android-App/proguard-android.txt new file mode 100644 index 00000000..fe73baeb --- /dev/null +++ b/News-Android-App/proguard-android.txt @@ -0,0 +1,57 @@ +# This is a configuration file for ProGuard. +# http://proguard.sourceforge.net/index.html#manual/usage.html + +-dontusemixedcaseclassnames +-dontskipnonpubliclibraryclasses +-verbose + +# Optimization is turned off by default. Dex does not like code run +# through the ProGuard optimize and preverify steps (and performs some +# of these optimizations on its own). +-dontoptimize +-dontpreverify +# Note that if you want to enable optimization, you cannot just +# include optimization flags in your own project configuration file; +# instead you will need to point to the +# "proguard-android-optimize.txt" file instead of this one from your +# project.properties file. + +-keepattributes *Annotation* +-keep public class com.google.vending.licensing.ILicensingService +-keep public class com.android.vending.licensing.ILicensingService + +# For native methods, see http://proguard.sourceforge.net/manual/examples.html#native +-keepclasseswithmembernames class * { + native ; +} + +# keep setters in Views so that animations can still work. +# see http://proguard.sourceforge.net/manual/examples.html#beans +-keepclassmembers public class * extends android.view.View { + void set*(***); + *** get*(); +} + +# We want to keep methods in Activity that could be used in the XML attribute onClick +-keepclassmembers class * extends android.app.Activity { + public void *(android.view.View); +} + +# For enumeration classes, see http://proguard.sourceforge.net/manual/examples.html#enumerations +-keepclassmembers enum * { + public static **[] values(); + public static ** valueOf(java.lang.String); +} + +-keep class * implements android.os.Parcelable { + public static final android.os.Parcelable$Creator *; +} + +-keepclassmembers class **.R$* { + public static ; +} + +# The support library contains references to newer platform versions. +# Don't warn about those in case this app is linking against an older +# platform version. We know about them, and they are safe. +-dontwarn android.support.** diff --git a/News-Android-App/proguard-rules.txt b/News-Android-App/proguard-rules.txt index 5651a4af..da16ce6e 100644 --- a/News-Android-App/proguard-rules.txt +++ b/News-Android-App/proguard-rules.txt @@ -14,4 +14,46 @@ # class: #-keepclassmembers class fqcn.of.javascript.interface.for.webview { # public *; -#} \ No newline at end of file +#} + + + + +-keepnames class * implements java.io.Serializable + +-keepclassmembers class * implements java.io.Serializable { + static final long serialVersionUID; + private static final java.io.ObjectStreamField[] serialPersistentFields; + !static !transient ; + private void writeObject(java.io.ObjectOutputStream); + private void readObject(java.io.ObjectInputStream); + java.lang.Object writeReplace(); + java.lang.Object readResolve(); +} + + + + +# Butterknife +-keep class butterknife.** { *; } +-dontwarn butterknife.internal.** +-keep class **$$ViewBinder { *; } + +-keepclasseswithmembernames class * { + @butterknife.* ; +} + +-keepclasseswithmembernames class * { + @butterknife.* ; +} + + +############### +# I use proguard only to remove unused stuff and to keep the app small. +# I donot want to obfuscate (rename packages, classes, methods, ...) since this is open source +-keepnames class ** { *; } +-keepnames interface ** { *; } +-keepnames enum ** { *; } + + +-dontwarn de.greenrobot.daogenerator.DaoGenerator