#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' 中不公开.无法从外部包访问
基础教程推荐
- 将 double 转换为 Int,向下舍入 2022-01-01
- Java ECDSAwithSHA256 签名长度不一致 2022-01-01
- doFilter()是在servlet的工作完成之前还是之后执行的? 2022-01-01
- 如何在相机中应用自定义滤镜 [Surfaceview 预览]. 2022-01-01
- 控制台应用程序中的 Java 键盘输入解析 2022-01-01
- Maven:无效的目标版本:10 2022-01-01
- 将 Windows 证书导入 Java 2022-01-01
- JPA惰性列表上的流 2022-01-01
- 在springboot中如何给mybatis加拦截器 2023-04-29
- 在java中使用xpath和selenium解析HTML表格数据 2022-01-01
