android -------- 混淆打包報錯(warning - InnerClass annotations are missing corresponding EnclosingMember annotations)
最近做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
}
}
}
打包錯誤如下圖
看圖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 -------- 混淆打包報錯(warning - InnerClass annotations are missing corresponding EnclosingMember annotations)