i never used proguard before, , force use due nasty samsung bug: https://code.google.com/p/android/issues/detail?id=78377
so, basically, followed explanations, , added in gradle file:
buildtypes { release { minifyenabled true proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' } }
and file contains line need workaround above bug:
-keep class !android.support.v7.internal.view.menu.**,** {*;}
note: have followed many , many proguard template files, , tried lot of code there, don't know do.
the app compiles fine in debug, on phone, once try compile apk , upload it, got error:
illegalstateexception: need use theme.appcompat theme (or descendant) activity.
please, not point me style.xml, theme appcompat, , works fine on debug.
thank lot help, or hint.
i used file: https://stackoverflow.com/a/8181232/327402
working fine now.
##---------------begin: proguard configuration common android apps ---------- -optimizationpasses 5 -dontusemixedcaseclassnames -dontskipnonpubliclibraryclasses -dontskipnonpubliclibraryclassmembers -dontpreverify -verbose -dump class_files.txt -printseeds seeds.txt -printusage unused.txt -printmapping mapping.txt -optimizations !code/simplification/arithmetic,!field/*,!class/merging/* -allowaccessmodification -keepattributes *annotation* -renamesourcefileattribute sourcefile -keepattributes sourcefile,linenumbertable -repackageclasses '' -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 -dontnote com.android.vending.licensing.ilicensingservice # explicitly preserve serialization members. serializable interface # marker interface, wouldn't save them. -keepclassmembers class * implements java.io.serializable { static final long serialversionuid; private 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(); } # preserve native method names , names of classes. -keepclasseswithmembernames class * { native <methods>; } -keepclasseswithmembernames class * { public <init>(android.content.context, android.util.attributeset); } -keepclasseswithmembernames class * { public <init>(android.content.context, android.util.attributeset, int); } # preserve static fields of inner classes of r classes might accessed # through introspection. -keepclassmembers class **.r$* { public static <fields>; } # preserve special static methods required in enumeration classes. -keepclassmembers enum * { public static **[] values(); public static ** valueof(java.lang.string); } -keep public class * { public protected *; } -keep class * implements android.os.parcelable { public static final android.os.parcelable$creator *; } ##---------------end: proguard configuration common android apps ---------- ##---------------begin: proguard configuration gson ---------- # gson uses generic type information stored in class file when working fields. proguard # removes such information default, configure keep of it. -keepattributes signature # gson specific classes -keep class sun.misc.unsafe { *; } #-keep class com.google.gson.stream.** { *; } # application classes serialized/deserialized on gson -keep class com.google.gson.examples.android.model.** { *; } ##---------------end: proguard configuration gson ----------
Comments
Post a Comment