android打包代码混淆
android应用打包代码混淆:
1.将project.propertier文件中的proguard.config=proguard-android.txt打开 拷贝指定的文件到应用中
2.更改proguard-android.txt文件
-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
-keep class * implements java.io.Serializable {*;}
-keep public class 包名.ViewWrapper{*;} //忽略包中的某个类
-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 *;
}
-dontwarn android.support.**
-dontwarn com.alibaba.**
-libraryjars libs/fastjson-1.1.33.jar //忽略第三方jar包
-keep class com.alibaba.fastjson.** {*;}
在使用fastjson封装多层集合的时候,应用运行始终无法通过,报无法转换异常,该忽略的都忽略了,但是还是异常,暂未找到解决办法。