Android代码混淆
来源:互联网 发布:网络投资是真的吗 编辑:程序博客网 时间:2024/06/07 01:12
1.一般的混淆
sdk\tools\proguard\文件夹下有Android混淆配置文件:
proguard-android-optmize.txt
copy文件到App根目录,具体内容可以看文件,这里对一些声明进行说明:
混淆时没有将下面类的子类混淆
android.app.Activity,
android.app.Service,
android.content.BroadcastReceiver,
android.content.ContentProvider
由于manifest文件中需要配置上面的信息,所以不混淆这些类名,如果混淆了就无法找到
所以解压之后会看到你自己定义的类名
#不混淆android.content.Context参数的构造方法-keepclassmember class *{ public <init>(android.content.Context)}
# 不警告Android支持库-dontwarn android.support.**
#WebView与网页JS交互JavascriptInterface类(提供JS调用方法)-keepclassmembers class com.xxx.interfaceClass{*;}
Baidu地图
#定位(百度地图)-keep class com.baidu.** {*;}-keep class vi.com.** {*;}-dontwarn com.baidu.**
OrmLite
#如果使用了数据库框架OrmLite-keep class com.j256.**-keepclassmembers class com.j256.** { *; }-keep enum com.j256.**-keepclassmembers enum com.j256.** { *; }-keep interface com.j256.**-keepclassmembers interface com.j256.** { *; }#保留数据库类和它的成员-keep class com.xxx-keep class com.xxxx-keepclassmembers class com.xxx{*;}-keepclassmembers class com.xxxx{*;}
在混淆中出现过“No fields have a DatabaseField annotation”,但参数已经声明了引用;经过尝试使用了ormlite中的“OrmLiteConfigUtil”配置类(详见 Android项目使用ORMLite数据库框架 之 使用数据库配置文件),在Raw/ormlite_config.txt文件,然后引用
public DaoHelper(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION,R.raw.ormlite_config); }
Gson相关混淆
##---------------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://stackoverflow.com/questions/8129040/proguard-missing-type-parameter
0 0
- Android 代码混淆,混淆打包
- Android 代码混淆 webview混淆
- [Android]混淆Android代码
- [Android]混淆Android代码
- Android代码混淆------apk文件代码混淆
- android 代码混淆proguard
- Android项目代码混淆
- android 代码混淆总结
- android 代码混淆
- android代码混淆
- 混淆Android代码
- Android代码混淆 反编译
- android 代码混淆
- Android 代码混淆
- android 代码混淆
- Android代码混淆技术
- android 代码混淆
- Android代码混淆
- 重新安装xcode时,插件失效办法
- Enum用法
- android:windowSoftInputMode属性详解
- java.io.IOException: Can't write xxx Can't read xxx
- 五、实体分析
- Android代码混淆
- docker安装入门
- CSS重置
- MRC和ARC混编
- ReentrantLock(重入锁)以及公平性
- Codeforces 593D - Happy Tree Party(树链剖分)
- ImportError: No module named _tkinter, please install the python-tk package ubuntu运行tkinter错误
- Eclipse导入Tomcat源码
- 判断一个应用程序是否已安装