This repository has been archived by the owner on Jan 14, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 545
Proguard configuration for RoboSpice projects
stephanenicolas edited this page Dec 4, 2012
·
9 revisions
Some comments let us think that not all Android Coders know that Proguard is a standard Android SDK tool. You can use it to shrink, shorten, obfuscate your Android apps. The APK size will be reduced, the classes will load faster into a Dalvik VM.
This page is dedicated to configuring Proguard to build apps based on RoboSpice in release mode.
# For RoboSpice
#Results classes that only extend a generic should be preserved as they will be pruned by Proguard
#as they are "empty", others are kept
-keep class <your REST POJOs package>.**
#RoboSpice requests should be preserved in most cases
-keepclassmembers class <your RoboSpice requests package>.** {
public void set*(***);
public *** get*();
public *** is*();
}
#Warnings to be removed. Otherwise maven plugin stops, but not dangerous
-dontwarn android.support.**
-dontwarn com.sun.xml.internal.**
-dontwarn com.sun.istack.internal.**
-dontwarn org.codehaus.jackson.**
-dontwarn org.springframework.**
-dontwarn java.awt.**
-dontwarn javax.security.**
-dontwarn java.beans.**
-dontwarn javax.xml.**
-dontwarn java.util.**
-dontwarn org.w3c.dom.**
-dontwarn com.google.common.**
-dontwarn com.octo.android.robospice.persistence.**
#if you use public fields instead of setter/getters for your REST POJOs, add this
-keepclassmembers class <you REST POJOs package>.** {
public <fields>;
}
### Jackson SERIALIZER SETTINGS
-keepclassmembers,allowobfuscation class * {
@org.codehaus.jackson.annotate.* <fields>;
@org.codehaus.jackson.annotate.* <init>(...);
}
## Gson SERIALIZER SETTINGS
# See https://code.google.com/p/google-gson/source/browse/trunk/examples/android-proguard-example/proguard.cfg
# 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
# Gson specific classes
#-keep class sun.misc.Unsafe { *; }
### Simple XML SERIALIZER SETTINGS
-keepclassmembers,allowobfuscation class * {
@org.simpleframework.xml.* <fields>;
@org.simpleframework.xml.* <init>(...);
}
Snippet from Google Http Java Client setup wiki page:
# Needed by google-api-client to keep generic types and @Key annotations accessed via reflection
-keepclassmembers class * {
@com.google.api.client.util.Key <fields>;
}
-keepattributes Signature,RuntimeVisibleAnnotations,AnnotationDefault
# Needed by Guava
-dontwarn sun.misc.Unsafe
# See https://groups.google.com/forum/#!topic/guava-discuss/YCZzeCiIVoI
-dontwarn com.google.common.collect.MinMaxPriorityQueue
Thanks to Vincent Lemeunier for helping us building this page.