android 混淆
来源:互联网 发布:日本之家 知乎 编辑:程序博客网 时间:2024/06/06 10:49
1,混淆
为了防止自己的劳动成果被别人窃取,混淆代码能有效防止被反编译,下面来总结以下混淆代码的步骤:
1. 大家也许都注意到新建一个工程会看到项目下边有这样proguard-rules.pro一个文件,这个对混淆代码很重要,如果你不小心删掉了,没关系,从其他地方拷贝一个过来
2, proguard-rules.pro添加混淆的申明
# Add project specific ProGuard rules here.# By default, the flags in this file are appended to flags specified# in /Users/liuhanlin/Library/Android/sdk/tools/proguard/proguard-android.txt# You can edit the include path and order by changing the proguardFiles# directive in build.gradle.## For more details, see# http://developer.android.com/guide/developing/tools/proguard.html# Add any project specific keep options here:# If your project uses WebView with JS, uncomment the following# and specify the fully qualified class name to the JavaScript interface# class:#-keepclassmembers class fqcn.of.javascript.interface.for.webview {# public *;#}
a. 把所有你的jar包都申明进来,例如: -libraryjars libs/apns_1.0.6.jar -libraryjars libs/armeabi/libBaiduMapSDK_v2_3_1.so -libraryjars libs/armeabi/liblocSDK4.so-libraryjars libs/baidumapapi_v2_3_1.jar
b. 将你不需要混淆的部分申明进来,因为有些类经过混淆会导致程序编译不通过,如下:-keep class com.pili.pldroid.player.** { *; }-keep class tv.danmaku.ijk.media.player.** {*;}
有些很特殊的,例如百度地图,你需要添加以下申明:
-keep class com.baidu.* { ; }
-keep class vi.com.gdi.bgl.android.*{;}
根据我的经验,一般model最好避免混淆(model无关紧要,不混淆也没多大关系)如:
-keep class com.bank.pingan.model.* { ; }
3,申明
以上工作完成,混淆工作就完成了一大半了,最后需要做的就是在project.properties文件中加上你的混淆文件申明了,如下: proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt最后一步,打签名包测试,如果有问题,仔细看下Log也许有得类不能混淆,那么你得加入到proguard-project.txt文件中-------以上就是混淆代码的全过程了
0 0
- Android混淆
- android 混淆
- Android 混淆
- Android-混淆
- Android 混淆
- android 混淆
- android 混淆
- android 混淆
- android混淆
- android混淆
- android混淆
- Android混淆
- android 混淆
- android混淆
- android混淆
- android混淆
- android混淆
- Android混淆
- 五层原理体系结构的简单分析
- SparkSQL和Hive在做cast boolean存在的不同
- Qt阻塞延时与非阻塞延时(四种方法之个人笔记)
- ActiveX去掉限制
- Linux 报错could not update ICEauthority file 解决方法
- android 混淆
- 《Spring实战》学习笔记-第五章:构建Spring web应用
- mysql水平拆分与垂直拆分的详细介绍
- 小经验
- linux 常用makefile模板
- R爬虫(一)
- 安卓e.printStackTrace()打印方法
- Log4J日志配置详解和自定义log4j日志级别及输出日志到不同文件实现方法
- 使用 CSS 去掉 iPhone 网页上按钮的超大圆角默认样式