代码混淆错误

作者: 祥龙翔天 | 来源:发表于2018-05-08 15:48 被阅读0次

    编译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.** { *;}
    

    相关文章

      网友评论

        本文标题:代码混淆错误

        本文链接:https://www.haomeiwen.com/subject/fgcwrftx.html