Android studio warning - InnerClass annotations are missing corresponding EnclosingMember annotations

若如初见. 提交于 2019-11-28 22:23:35

问题


I recently upgraded to Android Studio 3.1 and upon building my Kotlin with Java project I got the following warning.

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]}

Here are my Gradle details.

android {
compileSdkVersion 27
//buildToolsVersion '27.0.3'
defaultConfig {
    minSdkVersion 16
    targetSdkVersion 27
    applicationId "org.myapp"
    versionCode generateVersionCode()
  //...
    multiDexEnabled true
}

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

It doesn't direct me to where the issue is. How can I locate the offending code?


回答1:


It may because some annotations be confused, so just add proguard rule:

-keepattributes *Annotation*
-keep @**annotation** class * {*;}

it worked fine to me.




回答2:


To fix the issue temporarily, I am adding this:

buildTypes {
    release {
        lintOptions {
            checkReleaseBuilds false
            abortOnError false
        }
    }
}

Will update if I find a permanent fix. This page for configuring JUnit 5 may also help



来源:https://stackoverflow.com/questions/49517898/android-studio-warning-innerclass-annotations-are-missing-corresponding-enclos

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!