Android构建错误:找不到符号类IntDef

时间:2019-06-19 04:24:41

标签: java android dependencies implementation

使用Android Studio生成react native应用的android版本。我刚刚收到

  

“错误:找不到符号类IndDef”

在以下代码中使用:

@IntDef(flag = true, value = { Information.BATTERY, Information.RSSI, Information.API_VERSION, Information.LED,
            Information.APPLICATION_VERSION })

我的依存关系块的底部看起来像这样:

    implementation 'androidx.multidex:multidex:2.0.0'
    implementation 'androidx.legacy:legacy-support-core-utils:1.0.0'
    implementation 'androidx.appcompat:appcompat:1.0.0'

我需要在此文件的顶部进行导入吗?还是添加到{。{1}}之类的build.gradle中?

在依赖项块内?

除了ArrayMap出现问题外,我遇到了相同的问题,此问题已通过添加

修复。
implementation 'androidx.appcompat:appcompat:1.0.0'

在依赖项中

1 个答案:

答案 0 :(得分:2)

您可能必须在build.gradle文件中包括以下内容:

dependencies {
    implementation 'com.android.support:support-annotations:28.0.0'
}

您的课程中的import语句将是这样的:

import android.support.annotation.IntDef;