Вопрос

I could understand if the API level required by the call was higher than the minimum, but why should it be a problem if it's equal to the minimum?

Это было полезно?

Решение

This was a bug in Android Studio 0.1. It is fixed for 0.1.1

See fix: https://android-review.googlesource.com/#/c/58798/1

Другие советы

I got the same problem in Android Studio; it was not a problem in IntelliJ which I had been using prior to AS.

To "fix it" I simply used the TargetApi annotation:

@TargetApi(8)

I only added it to my main Activity and the warnings went away everywhere.

In AndroidManifest.xmllook at uses-sdk and value of android:minSdkVersion. Make sure specified sdk version has level equal or higher then 8.

Android Studio has some lint problems because I have this same problem too. The project should still build though. if not just do a simple check for the build version

if(Build.VERSION.SDK_INT > Build.VERSION_CODES.ECLAIR_MR1){
    //code goes here
}

and that should suppress the lint check

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top