* 配置簽名資訊
* 配置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的包,需要設定混淆嗎?目前是沒發現要設定