android -------- 混淆打包报错(warning - InnerClass annotations are missing corresponding......)

最近做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......)_第1张图片

 

android -------- 混淆打包报错(warning - InnerClass annotations are missing corresponding......)_第2张图片

看图1

因为error之前,编译的时候前面肯定有warning. 翻了一下,果然发现很多warning.

有包的 33个 warning

com.yintong.secure

com.icbc.pay

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

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

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

你可能感兴趣的:(Android)