解決AS混淆時出現的錯誤Execution failed for task ':app:transformClassesAndResourcesWithProguardForRelease'
阿新 • • 發佈:2019-01-01
在整合騰訊buglySDK的時候出現的這個問題。順帶提一下bugly。這玩意最近騰訊更新SDK它集成了微信開源的熱修復框架技術Tinker。更多關於微信Tinker整合可以看這裡
開發者以後可以更加方便的使用熱修復功能以及bugly其他的功能。非常方便。在此對於將準備整合bugly的開發者建議是用as。好處就不多說了。迴歸正題。這是我遇到的錯誤:
Error:Execution failed for task ':app:transformClassesAndResourcesWithProguardForRelease'. > java.io.IOException: Can't write [D:\android_wk_henry_as\TestAppBugly\app\build\intermediates\transforms\proguard\release\jars\3\1f\main.jar] (Can't read [D:\android_wk_henry_as\TestAppBugly\app\build\intermediates\transforms\AuxiliaryInject\release\jars\1\1f\classes_63db0612d7cd5222bf5473108842b503.jar(;;;;;;**.class)] (Duplicate zip entry [android/support/v4/b/a/a$a.class == classes_63db0612d7cd5222bf5473108842b503.jar:android/support/v4/graphics/drawable/DrawableCompat$BaseDrawableImpl.class]))
Error:Execution failed for task ':app:transformClassesWithJarMergingForRelease'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/v4/database/DatabaseUtilsCompat.class
最開始看到cant write和大家一樣以為是6.0讀寫許可權問題。其實不是的。這裡就是單純的混淆時包衝突了。解決辦法:
首先看看proguard-rules.pro檔案,仔細檢查是否混淆有誤。
其次在根據上面錯誤指引[D:\android_wk_henry_as\TestAppBugly\app\build\intermediates\transforms\AuxiliaryInject\release\jars\1\1f\]來到這個目錄下面。