在proguard-rules.pro文件中添加
-keepattributes EnclosingMethod
然后在build.gradle编译配置中引用,例:
buildTypes {
debug {
debuggable true
jniDebuggable true
zipAlignEnabled true
minifyEnabled false
shrinkResources false
signingConfig signingConfigs.debug
}
release {
debuggable false
jniDebuggable false
zipAlignEnabled true
minifyEnabled true
shrinkResources true
signingConfig signingConfigs.release
proguardFiles getDefaultProguardFile('proguard- android.txt'), 'proguard-rules.pro'
}
}