Android混淆编译
来源:互联网 发布:mac os 软件开发 编辑:程序博客网 时间:2024/05/16 12:38
一、概述:
android发布签名包之前,混淆编译是必须的。由于我的sdk版本较高,因此新建android项目下有proguard-project.txt和project.properties这两个文件夹。
以下是一些混淆总结:
1、如果你的项目没有其他第三方包的话,那么进行混淆很简单,只需要将project.properties文件夹下面的注释解开就行,一点区别在于:如果你是2.3之前的sdk版本,那么就用这个proguard.config=proguard.cfg
如果是之后的则为:proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt。
2、如果有第三方包的话,混淆时需要注意。
二、混淆代码:
我的项目里面proguard-android.txt 混淆配置
# To enable ProGuard in your project, edit project.properties# to define the proguard.config property as described in that file.## Add project specific ProGuard rules here.# By default, the flags in this file are appended to flags specified# in ${sdk.dir}/tools/proguard/proguard-android.txt# You can edit the include path and order by changing the ProGuard# include property in project.properties.## For more details, see# http://developer.android.com/guide/developing/tools/proguard.html# Add any project specific keep options here:# 指明lib包的在工程中的路径 否则导出包的时候会有这样的错误 You may need to specify additional library jars (using '-libraryjars').-libraryjars libs/achartengine-1.1.0.jar-libraryjars libs/android-support-v4.jar-libraryjars libs/asynchttp.jar-libraryjars libs/pinyin4j-2.5.0.jar# 去除在控制台中报warning警告-ignorewarnings-optimizationpasses 4-dontusemixedcaseclassnames-verbose-dontwarn demo.** -keep class demo.** { *;}# 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 *;#}
-dontwarn com.xx.bbb.**
和-keep class com.xx.bbb.** { ;}
这两个参数用来保持第三方库中的类而不乱,
将-dontwarn和-keep 结合使用,意思是保持com.xx.bbb.*这个包里面的所有类和所有方法而不混淆,
接着还叫proguard不要警告找不到com.xx.bbb.**这个包里面的类的相关引用。
三、问题的解决:
打签名包失败同时在查看控制台的时候也会发现 “You may need to specify additional library jars (using ‘-libraryjars’).” 的报错提示:
出现此错误提示是因为使用了 proguard 代码混淆器,同时在项目中引用了第三方 jar 包,但却没有在proguard 的配置文件中标明引用了的 jar 包所致。
解决方法如下:
在项目的目录下找到 proguard-project.txt 文件,将其打开后在任一空行中使用 -libraryjars 标明所有引用的第三方 jar 包。如下所示:
-libraryjars libs/achartengine-1.1.0.jar
-libraryjars libs/android-support-v4.jar
-libraryjars libs/asynchttp.jar
-libraryjars libs/pinyin4j-2.5.0.jar
四、补充:
为了apk的安全起见,还可以再用一些加固软件进行加固。
- Android 混淆打包编译
- Android混淆编译(图文)
- Android混淆编译
- Android混淆编译Proguard
- Android 反混淆编译
- android studio 混淆编译
- Android混淆编译、反混淆、反编译
- android混淆编译 ---- 问题汇总
- Android源码混淆编译app
- android混淆编译 ---- 问题汇总
- 【Android】【编译】代码混淆相关
- android studio 混淆编译注意
- Android Ant编译时候进行混淆
- Android中使用ant混淆编译
- 编译Android 程序时 代码 混淆
- android开发之——混淆编译
- android开发之——混淆编译
- Android Ant编译时候进行混淆
- 开源资料下载大全
- 使用Struts2和jQuery EasyUI实现简单CRUD系统(七)——数据分页处理
- 一个PostgreSQL用户眼里的Oracle性能优化
- LVS 配置
- 使用Shell脚本对Linux系统和进程资源进行监控 http://www.csdn.net/article/2012-06-26/2806898
- Android混淆编译
- 程序猿的幽默你不懂--段子精选
- Swift 第十课继承
- Java ee 规范
- 如何在App中实现朋友圈功能之一朋友圈实现原理浅析——箭扣科技Arrownock
- mac版本android studio 较为常用的快捷键
- 2015网络赛北京赛区G题(bfs+预处理)
- 苹果电脑截图方法
- 【bzoj2982】 combination LUCAS定理