android程序出现了奇怪的错误  Field requires API level 5 (current min is 1): ......

解决办法:

Right click on the project folder > Android tools > Clear Link Markers

英文网站找的,细节就看不懂了。参见
http://stackoverflow.com/questions/10322482/android-lint-erroneously-thinks-min-sdk-version-is-1

Eclipse refuses to build my Android project. In the package explorer, the project root node has the little red error symbol, but nothing else inside of it has this symbol. The Problems tab shows errors detected by Lint:

Call requires API level 3 (current min is 1): android.os.AsyncTask#<init>
Call requires API level 3 (current min is 1): android.view.GestureDetector#<init>
Call requires API level 3 (current min is 1): android.view.inputmethod.InputMethodManager#hideSoftInputFromWindow
Call requires API level 3 (current min is 1): android.view.inputmethod.InputMethodManager#hideSoftInputFromWindow
Call requires API level 3 (current min is 1): android.view.inputmethod.InputMethodManager#showSoftInput
Call requires API level 3 (current min is 1): android.view.inputmethod.InputMethodManager#showSoftInput
Call requires API level 3 (current min is 1): android.view.inputmethod.InputMethodManager#showSoftInput
Call requires API level 3 (current min is 1): android.view.inputmethod.InputMethodManager#toggleSoftInput
Call requires API level 3 (current min is 1): android.view.Menu#getItem
Call requires API level 3 (current min is 1): android.view.Menu#getItem
Call requires API level 3 (current min is 1): android.widget.HorizontalScrollView#getId
Call requires API level 5 (current min is 1): android.app.Activity#onBackPressed
Call requires API level 5 (current min is 1): android.app.Activity#onBackPressed
Call requires API level 5 (current min is 1): android.app.Activity#onBackPressed
Class requires API level 3 (current min is 1): android.view.inputmethod.InputMethodManager
Class requires API level 3 (current min is 1): android.view.inputmethod.InputMethodManager
Class requires API level 3 (current min is 1): android.view.inputmethod.InputMethodManager
Class requires API level 3 (current min is 1): android.view.inputmethod.InputMethodManager
Class requires API level 3 (current min is 1): android.view.inputmethod.InputMethodManager
Class requires API level 3 (current min is 1): android.view.inputmethod.InputMethodManager
Class requires API level 3 (current min is 1): android.widget.HorizontalScrollView
Class requires API level 3 (current min is 1): android.widget.HorizontalScrollView
Field requires API level 3 (current min is 1): android.os.Build#DISPLAY
Field requires API level 4 (current min is 1): android.content.res.Configuration#screenLayout
Field requires API level 4 (current min is 1): android.os.Build#CPU_ABI
Field requires API level 4 (current min is 1): android.os.Build#MANUFACTURER
Field requires API level 4 (current min is 1): android.os.Build$VERSION#SDK_INT

My best guess is that Lint thinks my minSdkVersion is 1, which it isn't; my manifest declares minSdkVersion="8". I've tried the following in an effort to fix this:

  • Restarting Eclipse
  • Restarting my computer
  • Project > Clean
  • Manually deleting /bin and /gen to force hem to be generated again

At this point I'm out of ideas. Anybody have suggestions?

android eclipse build compiler-errors android-lint
share|improve this question
edited Aug 2 at 15:28
Bananeweizen
4,5841728

asked Apr 25 at 19:31
jdk
3814

 
Do you have other project opened in eclipse? If yes, close all but hte one you're working with (even libraries). Then re-run lint. – inazaruk Apr 25 at 19:39
 
I confirm this also happened to me when I moved the working Android project into subfolder on the workspace. Android tools > Clear Link Markers seems a working workaround. – user197831 Oct 12 at 9:41
Was this post useful to you?     

2 Answers

activeoldestvotes
up vote 19 down vote accepted

I have the same problem, and my solution is:

Right click on the project folder > Android tools > Clear Link Markers

"Run Android Lint" makes some markers and the markers cause this error.

share|improve this answer
answered Apr 26 at 9:19
guanfei
2103

 
I believe this is what I did, but somehow did it from the Problems tab through right-clicking and selecting something ... I'm honestly not sure what, but I remember a "Clear Lint Markers" being part of it, so this gets the checkmark. – jdk Apr 26 at 17:48
 
On other solution is to move a project to the top level of the workspace instead of some subfolder – Seppl Jul 11 at 8:43
 
Even on doing this, the error appeared. Needed to close and reopen the project in addition to "Clear Lint Markers". – tarkeshwar Aug 6 at 9:19
feedback
up vote 0 down vote

Try right clicking on the project folder > Android tools > fix properties

You should also check in the build properties that all your android libraries and things are checked and loading in the correct order. Right click on the project > Properties > Build

share|improve this answer
answered Apr 25 at 19:59
El Duderino
2677

 
feedback

android程序出现了奇怪的错误 Field requires API level 5 (current min is 1): ......相关推荐

  1. SimpleDateFormat 出现错误 Call requires API level 24 (current min is 15)

    这个故事是这样的 今天写打卡时间的时候需要获取一下当前时间,然后我就写了一个这个 [java] view plaincopy SimpleDateFormat sDF =   new SimpleDa ...

  2. 关于Android错误 View requires API level 14 (current...

    2019独角兽企业重金招聘Python工程师标准>>> 问题描述:在界面配置文件main.xml中,可能用上某些控件(例如GridLayout)遇上下面所说的错误:View requ ...

  3. Android中使用getDrawable时提示:Call requires API level 21(current min is 15)

    场景 在通过getDrawable方法获取照片资源时提示: Call requires API level 21(current min is 15) 注: 博客: https://blog.csdn ...

  4. 解决Android Studio中 Call requires API level 18 (current min is 15)问题

    Android Studio今天用蓝牙的时候出现一个奇怪的问题 final BluetoothManager bluetoothManager = (BluetoothManager) getSyst ...

  5. Android Call requires API level 11 (current min is 8)的解决方案

    [错误描述] 在用Eclipse开发过程中,为了兼容Android2.2和4.0以上版本,我在使用Notification类时做了2个版本的代码,代码根据系统版本不同执行相应模块,结果,等我输完代码, ...

  6. Error: Call requires API level 11 (current min is 8): android.app.Activity#onCreateView

    20151106: 通过默认设置创建一个项目,如图: 创建好了之后,打开 MainActivity.java 发现里面有报错,如图: 处理方式1: 将 AndroidManifest.xml 中的 & ...

  7. AndroidStudio_Android Studio项目中报Call requires API level 18 (current min is 16)---Android原生开发工作笔记232

    这个问题的解决非常简单,昨天发现的,因为对接第三方硬件的时候,对sdk的版本要求不一样导致的这问题. 只需要找到对应工程的,比如上面那个defaultConfig, 然后修改minSdkVersion ...

  8. Android SDK版本号 与 API Level 对应关系

    转自:https://blog.csdn.net/qiaoquan3/article/details/70185550 Android SDK版本号 与 API Level 对应关系 新接触Andro ...

  9. Android API level 版本对应关系

    详情地址:http://developer.android.com/guide/topics/manifest/uses-sdk-element.html Platform Version API L ...

最新文章

  1. 4个轮子+1部手机=长城眼里的智能汽车现状
  2. Node 连接mysql数据库
  3. php获取时间计算时间差
  4. 机器人码垛搬运编程程序_一条指令搞定机器人搬运程序
  5. android 常用依赖库
  6. DAY8-打卡第八天-2018-1-18
  7. AccessibilityService+OpenCV实现微信7.0.0抢红包插件
  8. Unable to start activity ComponentInfo,请教如何解决?
  9. 威联通212-P 安装远程迅雷,docker安装远程迅雷
  10. gstreamer学习笔记:将音视频合成MPEG2-TS流并打包通过rtp传输
  11. STM32机器人控制开发教程No.3 使用遥控控制电机/舵机(基于HAL库)
  12. Cousera Machine Learning 笔记:Gradient Descent
  13. Windows系统解决谷歌翻译不能用的问题
  14. windows11 + linux 蓝牙连接问题
  15. 安装XAMPP端口冲突问题
  16. 蓝牙架构(6)—— 3 数据传输架构(3.1 核心传输载体)
  17. python中矩阵乘以常数_在python(H.W)中单独乘以矩阵
  18. kernel 启动过程之三, start_kernel()函数 概叙!init/main.c
  19. mt4怎么修改服务器代码,如何修改指标参数?
  20. 课程设计书五子棋AI算法及其实现

热门文章

  1. 第28届深圳国际礼品展圆满闭幕,五洲御瓷再续“新里程”
  2. 猿团专访 |以技术推动发展 msup 成为企业经验智库
  3. 网络危机-负面信息处理
  4. springMVC中前端同名name与后端接收
  5. 程序员笔记本性能需求分析--2020年--极致性价比(真香定律)
  6. 线性代数基础知识:求矩阵的特征值、特征向量和协方差矩阵
  7. 推荐国外经典计算机教材9本
  8. 微信和淘宝最赤裸的分析 转载
  9. 耀耀学院task1-task3练习总结
  10. J-Link各版本驱动的下载