-keep public class * extends android.support.v7.app.ActionBarActivity
-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 all serialization members. The Serializable interface
is only a marker interface, so it 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 all native method names and the names of their classes.
-keepclasseswithmembernames class * {
native ;
}
-keepclasseswithmembernames class * {
public (android.content.Context, android.util.AttributeSet);
}
-keepclasseswithmembernames class * {
public (android.content.Context, android.util.AttributeSet, int);
}
Preserve static fields of inner classes of R classes that might be accessed
through introspection.
-keepclassmembers class *.R$ {
public static ;
}
Preserve the special static methods that are required in all enumeration classes.
-keepclassmembers enum * {
public static _[] values();
public static _ valueOf(java.lang.String);
}
commented out as removing it reduces the size considerably
-keep public class * {
public protected *;
}
-keep class * implements android.os.Parcelable {
public static final android.os.Parcelable$Creator *;
}
---------------End: proguard configuration common for all Android apps ----------
---------------Begin: proguard configuration for Gson ----------
Gson uses generic type information stored in a class file when working with fields. Proguard
removes such information by default, so configure it to keep all of it.
-keepattributes Signature
For using GSON @Expose annotation
-keepattributes Annotation
Gson specific classes
-keep class sun.misc.Unsafe { *; }
-keep class com.google.gson.stream.* { ; }
Application classes that will be serialized/deserialized over Gson
-keep class com.google.gson.examples.android.model.* { _; }
-keep class com.tweetstudio.tweet_studioapp.dto.* { ; }
---------------End: proguard configuration for Gson ----------
--------For Google Play services-------------
-keep class * extends java.util.ListResourceBundle {
protected Object[][] getContents();
}
-keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable {
public static final *\ NULL;
}
-keepnames @com.google.android.gms.common.annotation.KeepName class
-keepclassmembernames class * {
@com.google.android.gms.common.annotation.KeepName ;
}
-keepnames class * implements android.os.Parcelable {
public static final \ CREATOR;
}
----------End: proguard configuration for google play---------------
-keepclassmembers class * {
public void onEvent();
}
Hi!
I am getting long list of of warning when i am trying to export the apk with proguard enabled. For example:
Warning: com.gc.materialdesign.views.Button: can't find referenced class com.gc.materialdesign.R$id
Also my proguard cofig is:
-dontwarn org.apache.** -dontskipnonpubliclibraryclassmembers
---------------Begin: proguard configuration common for all Android apps ----------
-optimizationpasses 5 -dontpreverify -optimizations !code/simplification/arithmetic,!field/,!class/merging/
-allowaccessmodification -keepattributes Annotation -keepattributes SourceFile,LineNumberTable -repackageclasses ''
-keep public class * extends android.app.Activity
-keep public class * extends android.support.v7.app.ActionBarActivity
-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 all serialization members. The Serializable interface
is only a marker interface, so it 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 all native method names and the names of their classes.
-keepclasseswithmembernames class * { native;
}
-keepclasseswithmembernames class * { public(android.content.Context, android.util.AttributeSet);
}
-keepclasseswithmembernames class * { public(android.content.Context, android.util.AttributeSet, int);
}
Preserve static fields of inner classes of R classes that might be accessed
through introspection.
-keepclassmembers class *.R$ { public static;
}
Preserve the special static methods that are required in all enumeration classes.
-keepclassmembers enum * { public static _[] values(); public static _ valueOf(java.lang.String); }
commented out as removing it reduces the size considerably
-keep public class * {
public protected *;
}
-keep class * implements android.os.Parcelable { public static final android.os.Parcelable$Creator *; }
---------------End: proguard configuration common for all Android apps ----------
for support library
-keep class android.support.v7.* { ; } -keep interface android.support.v7.* { ; } -keep class android.support.v4.* { ; } -keep class android.support.v13.* { ; } -keep interface android.support.v4.* { ; } -keep interface android.support.v13.* { ; }
for retracing obfuscated stack traces
-keepattributes SourceFile,LineNumberTable
---------------Begin: proguard configuration for Gson ----------
Gson uses generic type information stored in a class file when working with fields. Proguard
removes such information by default, so configure it to keep all of it.
-keepattributes Signature
For using GSON @Expose annotation
-keepattributes Annotation
Gson specific classes
-keep class sun.misc.Unsafe { *; }
-keep class com.google.gson.stream.* { ; }
Application classes that will be serialized/deserialized over Gson
-keep class com.google.gson.examples.android.model.* { _; } -keep class com.tweetstudio.tweet_studioapp.dto.* { ; }
---------------End: proguard configuration for Gson ----------
--------For Google Play services-------------
-keep class * extends java.util.ListResourceBundle { protected Object[][] getContents(); }
-keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable { public static final *\ NULL; }
-keepnames @com.google.android.gms.common.annotation.KeepName class -keepclassmembernames class * { @com.google.android.gms.common.annotation.KeepName ; }
-keepnames class * implements android.os.Parcelable { public static final \ CREATOR; }
----------End: proguard configuration for google play---------------
-keepclassmembers class * { public void onEvent(); }
-------- End: Path-----------
Thanks.