Android Studio警告-InnerClass批注缺少相应的EnclosingMember批注 [英] Android studio warning - InnerClass annotations are missing corresponding EnclosingMember annotations

查看:373
本文介绍了Android Studio警告-InnerClass批注缺少相应的EnclosingMember批注的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近升级到Android Studio 3.1,并在使用Java项目构建Kotlin时收到以下警告.

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

InnerClass注释缺少相应的EnclosingMember 注释.这样的InnerClass注释将被忽略.

InnerClass annotations are missing corresponding EnclosingMember annotations. Such InnerClass annotations are ignored.

消息{种类=警告,文本= InnerClass注释丢失 相应的EnclosingMember批注.这样的InnerClass注释 被忽略.,sources = [未知源文件]}

Message {kind=WARNING, text=InnerClass annotations are missing corresponding EnclosingMember annotations. Such InnerClass annotations are ignored., sources=[Unknown source file]}

这是我的Gradle详细信息.

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?

推荐答案

可能是因为某些注释被混淆了,所以只需添加proguard规则即可:

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

-keepattributes *注释*
-keep @ ** annotation **类* {*;}

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

对我来说很好.

这篇关于Android Studio警告-InnerClass批注缺少相应的EnclosingMember批注的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆