Eclipse拒绝构建我的Android项目。在包浏览器中,项目根节点具有小红色错误符号,但其中没有任何其他内容具有此符号。 “问题”选项卡显示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
我最好的猜测是Lint认为我的minSdkVersion是1,它不是;我的清单声明minSdkVersion="8"
。我已经尝试了以下方法来解决这个问题:
/bin
和/gen
以强制重新生成下摆此时我没有想法。有人有建议吗?
答案 0 :(得分:76)
我遇到同样的问题,我的解决方案是:
右键单击项目文件夹&gt; Android工具&gt;清除棉绒标记
“运行Android Lint”会生成一些标记,并且标记会导致此错误。
答案 1 :(得分:16)
为了让它停止报告该错误,我必须完全禁用lint检查:
Right click project -> Properties -> Android Lint Preferences
Search for "minSdk" in the search box
Click on "UsesMinSdkAttributes"
Click the "Ignore All" button at the bottom.
清理并重建项目,Eclipse / ADT将不再对项目中的minSdk运行lint检查。
答案 2 :(得分:6)
确保 android:命名空间标识符与 minSdkVersion 属性一起使用。像这样:
android:minSdkVersion="8"
。
当基于一些Android示例项目(如BluetoothChat)创建项目时,名称空间被省略并混淆Lint。然后即使清除Lint Markers也无法真正解决问题,因为它们在再次运行Lint后重新出现,这种情况经常发生。
注意:这已通过API16
的样本修订版1进行了验证答案 3 :(得分:2)
尝试右键单击项目文件夹&gt; Android工具&gt;修复属性
您还应该检查构建属性,检查所有的android库和事物,并按正确的顺序加载。右键单击项目&gt;属性&gt;建立
答案 4 :(得分:1)
一个简单的项目 - &gt;清洁也为我解决了这个问题。