Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the API level of Android R/11 to set in build.gradle in Android Studio?

I can use API R via Android Studio Emulator. I know I can run directly from Android Studio but still I want to set in Gradle level.

android {
    compileSdkVersion 30
    defaultConfig {
        applicationId "com.example.test"
        minSdkVersion 21
        targetSdkVersion 30
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
like image 693
Pooja Singh Avatar asked Feb 25 '20 07:02

Pooja Singh


1 Answers

Now that the Android 11 (also known as Android R) SDK is released, the compile SDK version is simply 30:

android {
    compileSdkVersion 30

    defaultConfig {
        targetSdkVersion 30 // Optional: If you want to target R as well
        // ...
    }
    // ... 
}

No longer applicable:

When Android R was in the preview stage, the compile SDK version was 'android-R' and the target SDK version was 'R':

android {
    compileSdkVersion 'android-R'

    defaultConfig {
        targetSdkVersion 'R' // Optional: If you want to target R as well
        // ...
    }
    // ... 
}
like image 121
Ryan M Avatar answered Oct 05 '22 23:10

Ryan M