Android Lint erroneously thinks min SDK version is 1
Solution 1
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.
Solution 2
"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.
Solution 3
Make sure you have android: namespace identifier together with minSdkVersion attribute. Like this:
android:minSdkVersion="8"
.
When creating a project based on some Android sample projects (like BluetoothChat) the namespace gets omitted and confuses Lint. Then even clearing Lint Markers doesn't truly cure the issue as they reappear after running Lint again, which happens automatically pretty often.
Note: this was verified with samples revision 1 for API16
Solution 4
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
Solution 5
A simple Project -> Clean also fixed the issue for me.
jdk
Updated on July 29, 2020Comments
-
jdk almost 4 years
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?
-
jdk about 12 yearsI 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.
-
Display name almost 12 yearsOn other solution is to move a project to the top level of the workspace instead of some subfolder
-
tarkeshwar almost 12 yearsEven on doing this, the error appeared. Needed to close and reopen the project in addition to "Clear Lint Markers".
-
bvaughn about 11 yearsThis was driving me crazy! Thanks :)
-
MrCeeJ about 10 yearsThis worked for me, I tried most of the other solutions and was about to give up. I don't know if it actually changed anything or just told eclipse to rebuild caches (as usual) but it worked.
-
acrespo almost 10 yearsDoes everybody apply this temporary fix? Hasn't anyone found the correct fix to make lint understand what the minSdkVersion is????
-
El Duderino over 9 yearsSuper late response(sorry), but this is basically rebuilding the project with your properties updated. So yeah, basically just rebuilding; this is a different problem than the lint error though, sometimes a rebuild is just in order!
-
Gerald Schneider over 9 yearsThis is the actual solution. All other answers here are just workarounds. Add this to your AndroidManifest.xml
<uses-sdk android:minSdkVersion="12" android:targetSdkVersion="15" android:maxSdkVersion="19" />
-
sunskin over 9 years***For Android Studio, (if changes in AndroidManifest did not do any good for Sdk versions), try this - Right-click on the Project and click "Open Module Settings" and select "Flavors" and set Min Sdk Version and Target Sdk Version. Hope this helps someone