如果我从SDK打开android.content.SharedPreferences
类,我可以看到它导入了android.annotation.Nullable
类,但我无法打开该类,它不在我的类路径上。并且Android Studio无法识别此注释(因此在我的Kotlin代码中,当使用SharedPreferences类中的方法时,我没有获得适当的可空类型)。我有android.support.annotation.Nullable
,org.jetbrains.annotations.Nullable
,javax.annotation.Nullable
,但不是android.annotation.Nullable
。
我在类路径上的SDK中有android.jar
,android.annotation
包中有两个类:SuppressLint
和TargetApi
,但不是Nullable
。
我正在使用Android Studio 3.3.1并且刚刚使用Kotlin和5.0最小目标创建了默认项目。
This blog说:“android.annotation.Nullable
仅供内部使用。...使用android.support.annotation.Nullable
。”