java - android构建错误: can't find symbol class IntDef

标签 java android dependencies implementation

使用 Android Studio 构建 Android 版本的 React Native 应用。我刚收到

'error: cannot find symbol class IntDef'

在以下代码中使用:

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

我的依赖项 block 的底部如下所示:

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

我是否需要在此文件的顶部进行导入...或者我是否需要添加到 build.gradle 中,例如 implementation 'androidx.appcompat:appcompat:1.0.0'

在依赖 block 内?

除了ArrayMap,我遇到了同样的问题,这是通过添加

解决的
compile "com.android.support:support-core-utils:24.2.0"

在依赖中

最佳答案

您可能需要在 build.gradle 文件中包含以下内容:

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

类中的 import 语句是这样的:

import android.support.annotation.IntDef;

关于java - android构建错误: can't find symbol class IntDef,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56660045/

相关文章:

android - 当我在客户端发布数组 var 时,如何在 Android 中使用 NanoHTTPD 在服务器端检索数组?

Android JellyBean BigTextStyle 通知不工作 - HTC One X AT&T

android - Node JS FCM token 未向用户发送通知

java - Maven BOM [Bill Of Materials] 依赖

android - 为什么我要使用 $version 而不是 '2.7.0' ?

java - 将包含整数和字符串的文件拆分为仅字符串

java - hibernate 的命名查询有问题

java - 用 Java 编写文件解析器的技巧?

java - PHP exec Java cmd 失败,权限被拒绝

ffmpeg - 移除 QTKit 依赖