解決AS混淆時出現的錯誤:
Execution failed for task ‘:app:transformClassesAndResourcesWithProguardForRelease’
具體如下圖所示:
有4個warning,提示在 Common_SurfaceView類中找不到setZOrderMediaOverlay(boolean)方法,於是查詢整個項目發現並無使用過該方法,且該類中確實沒有這個方法。studiio溫馨提示必須處理上面的4個warning才能繼續打包。
經過多次嘗試如:-dontwarn class com.engin.ui.Fly_Common_SurfaceView.* { ;} 忽視該這個類的警告,發現卻仍舊報錯。
最後解決方案:在proguard-rules.pro混淆文件中 使用 -ignorewarnings 目的將警告忽視,最終打包成功。
問題2:
Warning:Exception while processing task java.io.IOException: proguard.ParseException: Unknown option ‘com.engin.ui.Fly_Common_SurfaceView.**’ in line 47 of file ‘F:\project\02_myproject\task05\HelpCenter\app\proguard-rules.pro’
原因:-dontwarn class com.engin.ui.Fly_Common_SurfaceView.{ *;} 在proguard-rules.pro混淆文件中添加該句話後就提示報混淆解析異常錯誤。上面語法錯誤:應該爲:-dontwarn com.engin.ui.Fly_Common_SurfaceView.