标签:
http://stackoverflow.com/questions/8129040/proguard-missing-type-parameter
# ------------------------------------- # android 原始混淆模板 # ------------------------------------- # ---------------------------------- # 通过指定数量的优化能执行 # -optimizationpasses n # ---------------------------------- -optimizationpasses 5 # ---------------------------------- # 混淆时不会产生形形色色的类名 # -dontusemixedcaseclassnames # ---------------------------------- #-dontusemixedcaseclassnames # ---------------------------------- # 指定不去忽略非公共的库类 # -dontskipnonpubliclibraryclasses # ---------------------------------- #-dontskipnonpubliclibraryclasses # ---------------------------------- # 不预校验 # -dontpreverify # ---------------------------------- # -dontpreverify # ---------------------------------- # 输出生成信息 # -verbose # ---------------------------------- -verbose # ---------------------------------- # 优化选项 # optimizations {optimization_filter} # ---------------------------------- -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 * extends android.app.backup.BackupAgentHelper -keep public class * extends android.preference.Preference -keep public class com.android.vending.licensing.ILicensingService -keepclasseswithmembernames class * { native <methods>; } # ----------------- # modify 修改合并 # ----------------- -keep public class * extends android.view.View { public <init>(android.content.Context); public <init>(android.content.Context, android.util.AttributeSet); public <init>(android.content.Context, android.util.AttributeSet, int); public void set*(...); } -keepclassmembers enum * { public static **[] values(); public static ** valueOf(java.lang.String); } -keep class * implements android.os.Parcelable { public static final android.os.Parcelable$Creator *; } #-------------------------- # 保护类型 -keepattributes 说明 # Exceptions, Signature, Deprecated, SourceFile, SourceDir, LineNumberTable, LocalVariableTable, # LocalVariableTypeTable, Synthetic, EnclosingMethod, RuntimeVisibleAnnotations, RuntimeInvisibleAnnotations, # RuntimeVisibleParameterAnnotations, RuntimeInvisibleParameterAnnotations, and AnnotationDefault # -------------------- -keepattributes ** -libraryjars <java.home>/lib/rt.jar # ---------------------- # 不压缩指定的文件 # -dontshrink # ---------------------- -dontshrink # ---------------------- # 不优化指定的文件 # -dontoptimize # ----------------------- -dontoptimize # ----------------------- # 不混淆指定的文件 # -dontobfuscate # ----------------------- # ----- 混淆包路径 ------- -repackageclasses ‘‘ -flattenpackagehierarchy ‘‘ -target 1.6 # -------- 以下是使用了 roboguice-1.1.2.jar 以及 guice-2.0-no_app.jar 功能需要保护的字段及类相关 -------- -keep class com.google.inject.Binder -keepclassmembers class * { @com.google.inject.Inject <init>(...); } -keepclassmembers class * { void *(**On*Event); } -keepclassmembers class **.R$* { public static <fields>; } # ------ 编译时需要用到的 jar 包 -libraryjars D:/dev_rc/android-sdk-windows/add-ons/addon_google_apis_google_inc_11/libs/maps.jar # ------ 保护 谷歌第三方 jar 包,界面特效 ---------- -keep class android.support.v4.** -dontwarn android.support.v4.** # ------ 保护百度地址jar包 -------- -keep class com.baidu.mapapi.** { *; } -dontwarn com.baidu.mapapi.** # --- 打包时忽略以下类的警告 -- -dontwarn com.classpackage.AA #-keepnames class * implements java.io.Serializable # ---------保护所有实体中的字段名称---------- -keepclassmembers class * implements java.io.Serializable { <fields>; } # --------- 保护类中的所有方法名 ------------ -keepclassmembers class * { public <methods>; }
##---------------Begin: proguard configuration common for all 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 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 <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 that might be accessed # through introspection. -keepclassmembers class **.R$* { public static <fields>; } # Preserve the special static methods that are required in all 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 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 # 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.** { *; } ##---------------End: proguard configuration for Gson ----------
标签:
原文地址:http://www.cnblogs.com/exmyth/p/4930962.html