I develop Android applications and use Proguard to obfuscate the code.
I am currently using ProGuard configurations:
-optimizationpasses 5 -dontusemixedcaseclassnames -dontskipnonpubliclibraryclasses -dontpreverify -verbose -optimizations !code/simplification/arithmetic,!field/*,!class/merging/* -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 com.android.vending.licensing.ILicensingService
To save custom component names that are used in XML layouts:
-keep public class custom.components.**
To remove debug logs:
-assumenosideeffects class android.util.Log { public static *** d(...); public static *** v(...); }
To avoid changing the names of methods called in the onClick layout:
-keepclassmembers class * { public void onClickButton1(android.view.View); public void onClickButton2(android.view.View); public void onClickButton3(android.view.View); } -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); } -keepclassmembers enum * { public static **[] values(); public static ** valueOf(java.lang.String); } -keep class * implements android.os.Parcelable { public static final android.os.Parcelable$Creator *; }
Question (is):
Are any other tags recommended? Why and why?
Can I comment on the proguard.cfg file? I would like to have it with comments that some lines do so that other developers do not doubt why I added.
Also in proguard can I save the comment header of a file (with copyright)? If this is not the case, or is it not a good policy, where should I add copyright?
android proguard
neteinstein Feb 21 '11 at 16:09 2011-02-21 16:09
source share