* 配置签名信息
* 配置ProGuard
在ProGuard中添加proguard.config=proguard.cfg
运行混淆器之后输出的文件有:
dump.txt
描述.apk包中所有class文件的内部结构。
mapping.txt
列出了源代码与混淆后的类,方法和属性名字之间的映射。这个文件对于在构建之后得到的bug报告是有用的,因为它把混淆的堆栈跟踪信息反翻译为源代码中的类,方法和成员名字。更多信息,查看解码混淆过的堆栈跟踪信息。
seeds.txt
列出那些未混淆的类和成员。
usage.txt
列出从.apk中剥离的代码
# 不使用优化方案
-dontoptimize
# 保留签名,解决泛型问题
-keepattributes Signature
-dontskipnonpubliclibraryclassmembers
-dontskipnonpubliclibraryclasses
#工程中用到的第三方包
-libraryjars libs/android-support-v4.jar
#不混淆第三方包
-keep class android.support.v4.**
#忽略第三方包导致的异常
-dontwarn android.support.v4.**
----------------------------- 异常信息如下
[proguard] Note: there were 1 references to unknown classes.
[proguard] You should check your configuration for typos.
[proguard] Warning: there were 269 unresolved references to classes or interfaces.
[proguard] You may need to specify additional library jars (using '-libraryjars'),
[proguard] or perhaps the '-dontskipnonpubliclibraryclasses' option.
[proguard] Warning: there were 57 unresolved references to program class members.
[proguard] Your input classes appear to be inconsistent.
[proguard] You may need to recompile them and try again.
[proguard] Alternatively, you may have to specify the options
[proguard] '-dontskipnonpubliclibraryclasses' and/or
[proguard] '-dontskipnonpubliclibraryclassmembers'.
BUILD FAILED
D:\android-sdk-windows\tools\ant\build.xml:736: Please correct the above warnings first.
参考资料:
Android 官方教程
http://developer.android.com/tools/help/proguard.html
官方文档中文翻译
http://www.cnblogs.com/over140/archive/2011/04/22/2024528.html
ProGuard官方网站
http://proguard.sourceforge.net/
Gson 打包问题
http://blog.csdn.net/codingandroid/article/details/9495405
? Android 导入的包如何处理?
分两类一类是第三方,一类是自己拥有源码的动态生成jar的包,需要设置混淆吗?目前是没发现要设置