Android Lint erroneously thinks min SDK version is 1

jdk picture jdk · Apr 25, 2012 · Viewed 23.3k times · Source

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?

Answer

guanfei picture guanfei · Apr 26, 2012

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.