L preview: Call requires API level 21 (current min is 20)

20,102

Solution 1

I updated Android Studio 0.6.1 to 0.8.0 and the error disappeared.

build.gradle looks exactly the same:

compileSdkVersion 'android-L'
buildToolsVersion '19.1.0'
defaultConfig {
    applicationId 'com.prt2121.tryl'
    minSdkVersion 'L'
    targetSdkVersion 'L'
    versionCode 1
    versionName '1.0'
}

I don't think my question is a duplicate but thanks anyway.

Solution 2

Change

android {
    compileSdkVersion 'android-L'
    buildToolsVersion '19.1.0'

to

android {
  compileSdkVersion 21
  buildToolsVersion '21.0.2'

Note android-L is in single quotes but 21 isn't. 21 is an integer and not a string.

Share:
20,102
pt2121
Author by

pt2121

started my career as a server-side java dev in 2005. now, mostly android.

Updated on July 09, 2022

Comments

  • pt2121
    pt2121 almost 2 years

    I am trying L and got an API level error. I have set the current min to 'L' but it seems Android Studio think it's 20.

    How to fix it?

    error

    gradle