Android 混淆打包遇到的問(wèn)題

使用 ButterKnife 后打包出錯(cuò)

解決方案是在 proguard-rules.pro 文件中忽略對(duì) ButterKnife 的混淆。

ButterKnife 7.0 以下:

-keep class butterknife.** { *; }
-dontwarn butterknife.internal.**
-keep class **$$ViewInjector{ *; }

-keepclasseswithmembernames class * {
    @butterknife.* <fields>;
}

-keepclasseswithmembernames class * {
    @butterknife.* <methods>;
}

ButterKnife 7.0 以上:

-keep class butterknife.** { *; }
-dontwarn butterknife.internal.**
-keep class **$$ViewBinder { *; }

-keepclasseswithmembernames class * {
    @butterknife.* <fields>;
}

-keepclasseswithmembernames class * {
    @butterknife.* <methods>;
}

使用 EventBus 后打包壓縮出錯(cuò)

解決方案是在 proguard-rules.pro 文件中忽略對(duì) EventBus 的混淆。

-keepattributes *Annotation*  
-keepclassmembers class ** {  
@org.greenrobot.eventbus.Subscribe <methods>;  
}  
-keep enum org.greenrobot.eventbus.ThreadMode { *; }  
  
# Only required if you use AsyncExecutor  
-keepclassmembers class * extends org.greenrobot.eventbus.util.ThrowableFailureEvent {  
<init>(java.lang.Throwable);  
}

aapt_rules.txt (系統(tǒng)找不到指定的路徑)

錯(cuò)誤:

Warning:Exception while processing task Java.io.FileNotFoundException: D:\...\app\build\intermediates\proguard-rules\release\aapt_rules.txt (系統(tǒng)找不到指定的路徑。)

解決:
菜單欄 Build --> Clean Project,clean 之后再 Build --> Make Project,再打包就好了

Error: Avoid non-default constructors in fragments

錯(cuò)誤:

Error: Avoid non-default constructors in fragments: use a default constructor plus Fragment#setArguments(Bundle) instead [ValidFragment]

解決:http://blog.csdn.net/chniccs/article/details/51258972

"XXX" is not translated in .....

錯(cuò)誤:

"app_name" is not translated in "af" (Afrikaans), "am" (Amharic), "ar" (Arabic), "bg" (Bulgarian), "ca" (Catalan),  
"cs" (Czech), "da" (Danish), "de" (German), "el" (Greek), "en-rGB" (English: United Kingdom), "en-rIN" (English:  
India), "es" (Spanish), "es-rUS" (Spanish: United States), "et-rEE" (Estonian: Estonia), "fa" (Persian),  

解決:http://www.codes51.com/article/detail_114285.html

release-stripped.ap_' specified for property 'resourceFile' does not exist

錯(cuò)誤:

Error:A problem was found with the configuration of task ':app:packageBAIDURelease'.
> File 'D:\AndroidStudioProjects\CodeBlog\app\build\intermediates\res\resources-BAIDU-release-stripped.ap_' specified for property 'resourceFile' does not exist.

解決:http://blog.csdn.net/brian512/article/details/52619548

使用 LitePal 后混淆出錯(cuò)

proguard-rules.pro 中忽略 LitePal。

-keep class org.litepal.** { *; }
-keep class * extends org.litepal.crud.DataSupport { *; }

更多關(guān)于混淆的問(wèn)題
關(guān)于混淆加密的文章

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容