Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 889
jdk Avatar asked Apr 25 '12 19:04

jdk


People also ask

What is the minimum android SDK version?

Override the minimum value of SDK version. minSdkVersion is the minimum version of the Android operating system required to run your application. The Android app must have a minimum SDK version 19 or higher. If you want to support devices below API level 19, you must override minSDK version.

What is the minimum sdk version for Android 11?

For the best development experience with the Android 11 SDK, use Android Studio 4.2 or higher.

What is the difference between Min sdk and target sdk?

The min sdk version is the earliest release of the Android SDK that your application can run on. Usually this is because of a problem with the earlier APIs, lacking functionality, or some other behavioural issue. The target sdk version is the version your application was targeted to run on.

How to change Min SDK version in Android Studio?

Click android studio menu ” File —> Project Structure “. In Project Structure dialog, select app in Modules list. Select Flavors tab in right panel, then you can select your desired android Min Sdk Version and Target Sdk Version.

What is the minimum SDK version required to use the widget?

This means your current android minimum SDK version is 1.7, which is too low to use this widget. You need to change it to 23. This article will show you how to change it in android studio. First, we should know the below two terms about the android SDK version.

Why call requires API level 23 in Android Studio?

When you use the android widget in layout XML or java code, you may encounter error messages like Call requires API level 23 (current min is 17):. This means your current android minimum SDK version is 1.7, which is too low to use this widget. You need to change it to 23. This article will show you how to change it in android studio.

What is the SDK version of an Android app?

First, we should know the below two terms about the android SDK version. minSdkVersion: This is the minimum version of android os that your app support. targetSdkVersion: This is the android os version which your app actually executed with. Your app should compatible with all the android os versions between minSdkVersion and targetSdkVersion. 1.


2 Answers

I have the same problem, and my solution is:

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

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

like image 171
guanfei Avatar answered Sep 17 '22 10:09

guanfei


"Clear Lint Markers" in the Accepted Answer removed the error temporarily, but it kept coming back every time I saved a file in the affected project.

To make it stop reporting that error, I had to disable the lint check altogether:

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. 

Clean and rebuild the project, and Eclipse/ADT will no longer run the lint check for minSdk on your project.

like image 27
DiscDev Avatar answered Sep 20 '22 10:09

DiscDev