【问题标题】:@SuppressLint and @TargetApi not working@SuppressLint 和 @TargetApi 不起作用
【发布时间】:2016-03-04 05:56:37
【问题描述】:

先决条件:OS X 上的 Eclipse Luna 4.4.2
问题:我想为 Android SDK 10 构建我的应用程序。Eclipse 似乎无法识别来自 androidannotations 的 @SuppressLint@TargetApi,并且不允许我使用 SDK 14 中的代码。
- 在 AndroidManifest.xml 中,我将 android:minSdkVersionandroid:targetSdkVersion 都设置为 10
- 在文件 project.properties 我设置target=android-10
- 在项目属性 > Android Lint 首选项中,我将 NewApi 严重性设置为“警告”
- annotations.jar 在 Android Dependencies 文件夹中
- 类截图,我在这里尝试了各种变体。我还尝试了清理、构建、重新打开...

【问题讨论】:

    标签: java android eclipse lint


    【解决方案1】:

    嗯,解决方案...

    • 将项目构建目标设置得更高(在我的例子中,我设置了 4.1.2)
    • 之后 Eclipse 建议我为“字段需要 API 级别 14(当前最低级别为 10):android.view.View#SYSTEM_UI_FLAG_HIDE_NAVIGATION”的一些变体,我选择了 @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH) 作为方法 @987654322 @

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-10-31
      • 2013-07-13
      • 1970-01-01
      相关资源
      最近更新 更多