From ea63fd16c87bcc3ff61593fbc730ad439c846a2d Mon Sep 17 00:00:00 2001 From: Floens Date: Wed, 18 Nov 2015 19:52:54 +0100 Subject: [PATCH] Update proguard file The build was giving an error so I redid the proguard file. This is the default optimized one with some additions for the used libraries. --- Clover/app/build.gradle | 7 +- Clover/app/proguard.cfg | 164 ++++++++++++++-------------------------- 2 files changed, 63 insertions(+), 108 deletions(-) diff --git a/Clover/app/build.gradle b/Clover/app/build.gradle index 80d943e0..96e2487d 100644 --- a/Clover/app/build.gradle +++ b/Clover/app/build.gradle @@ -37,7 +37,8 @@ android { if (doSign) { Properties props = new Properties() - props.load(new FileInputStream(f)) + InputStream is = new FileInputStream(f) + props.load(is) signingConfigs { release { @@ -47,6 +48,8 @@ android { keyPassword props['keyPass'] } } + + is.close() } buildTypes { @@ -65,6 +68,8 @@ android { debug { versionNameSuffix " Debug" +// minifyEnabled true +// proguardFiles 'proguard.cfg' } } diff --git a/Clover/app/proguard.cfg b/Clover/app/proguard.cfg index 95702e91..12b9f60d 100644 --- a/Clover/app/proguard.cfg +++ b/Clover/app/proguard.cfg @@ -1,120 +1,68 @@ -# Preverification is irrelevant for the dex compiler and the Dalvik VM. - --dontpreverify - -# Reduce the size of the output some more. - --repackageclasses '' +# This is a configuration file for ProGuard. +# http://proguard.sourceforge.net/index.html#manual/usage.html + +# Optimizations: If you don't want to optimize, use the +# proguard-android.txt configuration file instead of this one, which +# turns off the optimization flags. Adding optimization introduces +# certain risks, since for example not all optimizations performed by +# ProGuard works on all versions of Dalvik. The following flags turn +# off various optimizations known to have issues, but the list may not +# be complete or up to date. (The "arithmetic" optimization can be +# used if you are only targeting Android 2.0 or later.) Make sure you +# test thoroughly if you go this route. +-optimizations !code/simplification/arithmetic,!code/simplification/cast,!field/*,!class/merging/* +-optimizationpasses 5 -allowaccessmodification +-dontpreverify -# Switch off some optimizations that trip older versions of the Dalvik VM. - --optimizations !code/simplification/arithmetic,!code/allocation/variable - -# Keep a fixed source file attribute and all line number tables to get line -# numbers in the stack traces. -# You can comment this out if you're not interested in stack traces. - --renamesourcefileattribute SourceFile --keepattributes SourceFile,LineNumberTable +# The remainder of this file is identical to the non-optimized version +# of the Proguard configuration file (except that the other file has +# flags to turn off optimization). -# RemoteViews might need annotations. +-dontusemixedcaseclassnames +-dontskipnonpubliclibraryclasses +-verbose -keepattributes *Annotation* +-keep public class com.google.vending.licensing.ILicensingService +-keep public class com.android.vending.licensing.ILicensingService -# Preserve all fundamental application classes. - --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 - -# Preserve all View implementations, their special context constructors, and -# their setters. - --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*(...); +# For native methods, see http://proguard.sourceforge.net/manual/examples.html#native +-keepclasseswithmembernames class * { + native ; } -# Preserve all classes that have special context constructors, and the -# constructors themselves. - --keepclasseswithmembers class * { - public (android.content.Context, android.util.AttributeSet); +# 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*(); } -# Preserve all classes that have special context constructors, and the -# constructors themselves. - --keepclasseswithmembers class * { - public (android.content.Context, android.util.AttributeSet, int); +# 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); } -# Preserve the special fields of all Parcelable implementations. +# For enumeration classes, see http://proguard.sourceforge.net/manual/examples.html#enumerations +-keepclassmembers enum * { + public static **[] values(); + public static ** valueOf(java.lang.String); +} -keepclassmembers class * implements android.os.Parcelable { - static android.os.Parcelable$Creator CREATOR; + public static final android.os.Parcelable$Creator CREATOR; } -# Preserve static fields of inner classes of R classes that might be accessed -# through introspection. - -keepclassmembers class **.R$* { - public static ; + public static ; } -# Preserve the required interface from the License Verification Library -# (but don't nag the developer if the library is not used at all). - --keep public interface com.android.vending.licensing.ILicensingService - --dontnote com.android.vending.licensing.ILicensingService - -# The Android Compatibility library references some classes that may not be -# present in all versions of the API, but we know that's ok. - +# 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.** -# Preserve all native method names and the names of their classes. - --keepclasseswithmembernames class * { - native ; -} - -# Preserve the special static methods that are required in all enumeration -# classes. - --keepclassmembers class * extends java.lang.Enum { - public static **[] values(); - public static ** valueOf(java.lang.String); -} - -# Explicitly preserve all serialization members. The Serializable interface -# is only a marker interface, so it wouldn't save them. -# You can comment this out if your application doesn't use serialization. -# If your code contains serializable classes that have to be backward -# compatible, please refer to the manual. - --keepclassmembers class * implements java.io.Serializable { - static final long serialVersionUID; - static final java.io.ObjectStreamField[] serialPersistentFields; - private void writeObject(java.io.ObjectOutputStream); - private void readObject(java.io.ObjectInputStream); - java.lang.Object writeReplace(); - java.lang.Object readResolve(); -} - -# Your application may contain more items that need to be preserved; -# typically classes that are dynamically created using Class.forName: - -# -keep public class mypackage.MyClass -# -keep public interface mypackage.MyInterface -# -keep public class * implements mypackage.MyInterface - # OrmLite uses reflection -keep class com.j256.** -keepclassmembers class com.j256.** { *; } @@ -126,28 +74,30 @@ # Clover database models -keep class org.floens.chan.core.model.** { *; } -# Jsoup --keep public class org.jsoup.** { - public *; -} - +# Required for the gif library -keep public class pl.droidsonroids.gif.GifIOException{(int);} -keep class pl.droidsonroids.gif.GifInfoHandle{(long,int,int,int);} +# OkHttp and LeakCanary -dontwarn java.nio.** -dontwarn org.codehaus.mojo.** +# LeakCanary uses removed method (checks the API level) +-dontwarn com.squareup.leakcanary.DisplayLeakService + +# Jsoup +-keeppackagenames org.jsoup.nodes --keep class org.floens.chan.ui.layout.CaptchaLayout$CaptchaInterface --keep class * implements org.floens.chan.ui.layout.CaptchaLayout$CaptchaInterface --keepclassmembers class org.floens.chan.ui.layout.CaptchaLayout$CaptchaInterface { - ; +# JS interfaces +-keepclassmembers class * { + @android.webkit.JavascriptInterface ; } --keepattributes JavascriptInterface +# EventBus -keepclassmembers class ** { public void onEvent*(**); } --keep public class * extends android.support.design.** +#-keep public class * extends android.support.design.** +# Some reflection is used on RecyclerView -keep public class android.support.v7.widget.RecyclerView