Android proguard -applymapping 导致编译错误

-applymapping

Android代码混淆工具Proguard的配置文件proguard-rules.pro内选项,
用来维持两次混淆公用一份代码混淆符号表mapping.txt,确保相同的代码前后两次混淆后是一样的命名。

app的build.gradle文件中混淆配置如下(开启优化):

android {

    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

assembleRelease编译出现如下错误:

Warning:com.tencent.wxop.stat.StatConfig: method 'boolean isDebugEnable()' is not being kept as 'b', but remapped to 'a' 
Warning:com.tencent.wxop.stat.StatConfig: method 'boolean isDebugEnable()' is not being kept as 'a', but remapped to 'c'
Warning:uk.co.senab.photoview.PhotoViewAttacher: method 'boolean access$300()' is not being kept as 'a', but remapped to 'h'
Warning:uk.co.senab.photoview.PhotoViewAttacher: method 'boolean access$300()' is not being kept as 'h', but remapped to 'g'
Warning:there were 19 kept classes and class members that were remapped anyway.
You should adapt your configuration or edit the mapping file.If you are sure this remapping won't hurt, you could try your luckusing the '-ignorewarnings' option.
(http://proguard.sourceforge.net/manual/troubleshooting.html#mappingconflict1)
Warning:Exception while processing task java.io.IOException: Please correct the above warnings first.
:app:transformClassesAndResourcesWithProguardForRelease FAILED

改为如下(不开启优化)即可:

proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

你可能感兴趣的:(Android proguard -applymapping 导致编译错误)