#39;android.annotation.NonNull#39; is not public in #39;android.annotation#39;. Cannot be accessed from outside package(android.annotation.NonNull 在 android.annotation 中不公开.无法从外部包访问)
问题描述
我在尝试列出数据时收到此警告.有谁知道为什么?
I get this warning when I try to list data. Does anyone know why?
推荐答案
您指的是 Android 平台的内部注解,这些注解并不是您想要用于您自己的代码的注解.对于您的代码,您应该导入这些注释的 AndroidX 版本:
You're referring to the Android platform's internal annotations, which aren't the ones you want to use for your own code. For your code, you should import the AndroidX versions of those annotations:
androidx.annotation.NonNull
androidx.annotation.Nullable
等等.(注意 androidx
vs android
中额外的 x
)
etc. (note the extra x
in androidx
vs android
)
您还需要确保在 build.gradle
中声明了对 androidx.annotation:annotation
的依赖项(请参阅 这里获取最新版本信息)
You'll also want to make sure you have declared a dependency on androidx.annotation:annotation
in your build.gradle
(see here for the latest version information)
这篇关于'android.annotation.NonNull' 在 'android.annotation' 中不公开.无法从外部包访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:'android.annotation.NonNull' 在 'android.annotation' 中不公开.无法从外部包访问


- Java包名称中单词分隔符的约定是什么? 2022-01-01
- Eclipse 插件更新错误日志在哪里? 2022-01-01
- 如何使用WebFilter实现授权头检查 2022-01-01
- Safepoint+stats 日志,输出 JDK12 中没有 vmop 操作 2022-01-01
- value & 是什么意思?0xff 在 Java 中做什么? 2022-01-01
- Jersey REST 客户端:发布多部分数据 2022-01-01
- 将log4j 1.2配置转换为log4j 2配置 2022-01-01
- 从 finally 块返回时 Java 的奇怪行为 2022-01-01
- Spring Boot连接到使用仲裁器运行的MongoDB副本集 2022-01-01
- C++ 和 Java 进程之间的共享内存 2022-01-01