编译Release版本的apk时,出现transformClassesAndResourcesWithProguardForRelease错误
Execution failed for task ':xxxxxx:transformClassesAndResourcesWithProguardForRelease'.
AS报的具体错误如下图
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':xxxxxx:transformClassesAndResourcesWithProguardForRelease'.
> Job failed, see logs for details
接着上面的保持继续查找
Warning: library class android.content.pm.PackageManager depends on program class android.content.pm.IPackageDataObserver
Warning: library class android.content.pm.PackageManager depends on program class android.content.pm.IPackageDataObserver
Warning: library class android.content.pm.PackageManager depends on program class android.content.pm.IPackageDataObserver
对应自己的工程一看,发现自己把android.content.pm.PackageManager
放到了aidl里面,却没有对其加混淆保护。在proguard-rules.pro
里面增加下面的代码即可正常编译通过
-dontwarn android.content.pm.**
-keep class android.content.pm.** { *;}
网友评论