"android.annotation.NonNull"在"android.annotation"中不公开.无法从外部包访问 [英] 'android.annotation.NonNull' is not public in 'android.annotation'. Cannot be accessed from outside package

查看:3055
本文介绍了"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

等(请注意androidxandroid中的额外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"中不公开.无法从外部包访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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