android -------- 混淆打包报错(warning - InnerClass annotations are missing corresponding EnclosingMember a

时人不识凌云木,直待凌云始道高。这篇文章主要讲述android -------- 混淆打包报错(warning - InnerClass annotations are missing corresponding EnclosingMember a相关的知识,希望能为你提供帮助。
  最近做android混淆打包遇到一些问题,Android Sdutio 3.1 版本打包的
错误如下:

Android studio warning - InnerClass annotations are missing corresponding EnclosingMember annotations

 
InnerClass annotations are missing corresponding EnclosingMember annotations. Such InnerClass annotations are ignored.
Message{kind=WARNING, text=InnerClass annotations are missing corresponding EnclosingMember annotations. Such InnerClass annotations are ignored., sources=[Unknown source file], tool name=Optional.of(D8)}
 
解决方案
在build.gradle中加入以下代码即可
buildTypes {
    release {
        lintOptions {
            checkReleaseBuilds false
            abortOnError false
        }
    }
}
打包错误如下图
 
android -------- 混淆打包报错(warning - InnerClass annotations are missing corresponding EnclosingMember a

文章图片

 
android -------- 混淆打包报错(warning - InnerClass annotations are missing corresponding EnclosingMember a

文章图片

看图1
【android -------- 混淆打包报错(warning - InnerClass annotations are missing corresponding EnclosingMember a】因为error之前,编译的时候前面肯定有warning. 翻了一下,果然发现很多warning.
有包的 33个 warning
com.yintong.securecom.icbc.pay

 
接下来只要在proguard-rules.pro加下这个库的dontwarn即可

-dontwarn com.yintong.secure.** -dontwarn com.icbc.pay.**


 
再重新Build-> Generate Signed,就可以生成app-release.apk.
 

    推荐阅读