Proguard代码混淆器如何排除指定的类或子类
2017-03-23 17:16
316 查看
使用Proguard代码混淆器,特别要注意一点的就是使用了反射机制的类属性或方法最好不要参与混淆.
Proguard 4.5 相关的选项配置如下:
[plain] view
plain copy
#不要混淆MyBean的所有属性与方法
-keepclasseswithmembers class MyBean {
<fields>;
<methods>;
}
[html] view
plain copy
#不要混淆MySuperBean所有子类的属性与方法
-keepclasseswithmembers class * extends MySuperBean{
<fields>;
<methods>;
}
[plain] view
plain copy
#不混淆某个包下的类
-keep class com.google.** {*;}
如果项目中使用到 Gson(Json)那么要使用下面的代码
[html] view
plain copy
##---------------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.** { *; }
##---------------End: proguard configuration for Gson ----------
Proguard 4.5 相关的选项配置如下:
[plain] view
plain copy
#不要混淆MyBean的所有属性与方法
-keepclasseswithmembers class MyBean {
<fields>;
<methods>;
}
[html] view
plain copy
#不要混淆MySuperBean所有子类的属性与方法
-keepclasseswithmembers class * extends MySuperBean{
<fields>;
<methods>;
}
[plain] view
plain copy
#不混淆某个包下的类
-keep class com.google.** {*;}
如果项目中使用到 Gson(Json)那么要使用下面的代码
[html] view
plain copy
##---------------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.** { *; }
##---------------End: proguard configuration for Gson ----------
相关文章推荐
- Proguard代码混淆器如何排除指定的类或子类
- [android] Proguard代码混淆器如何排除指定的类或子类
- 使用JDBC-ODBC方式连接数据库时,如何在代码中指定ODBC数据源信息
- 请问各位如何用Delphi控制U盘的安全拔出????已经有源代码,但是不知道如何控制指定的U盘
- Shell环境下删除命令如何排除指定文件
- 纯代码写UI的时候,如何指定style?
- 如何把rose模型产生的代码输出到指定的目录下?
- Java代码加密与反编译(一):利用混淆器工具proGuard对jar包加密
- 如何混淆Android项目代码(ProGuard)防止反编译
- 如何用iframe代码显示调用网页的指定部分
- 如何用java代码给指定邮箱发送邮件
- 请问各位如何用Delphi控制U盘的安全拔出????已经有源代码,但是不知道如何控制指定的U盘
- 创建相关表的SELECT 语句(排除指定字段)的代码
- 开发小点滴:如何在c#代码里将指定字段绑定到item内的控件
- Android系统工具之Proguard 代码混淆器
- 命令行编译android程序,欢迎探讨命令行如何使用proguard混淆优化代码
- Java代码混淆器ProGuard
- 如何用iframe代码显示调用网页的指定部分
- [原]AS3 如何在影片剪辑上 Movieclip mc 指定帧添加代码程序
- VFP中,如何把指定目录信息(包括子目录)存入TXT文本文件!(已解决,代码实例)