繁体   English   中英

在 Android Studio 的 build.gradle 中设置 Android R/11 的 API 级别是什么?

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

我可以通过 Android Studio Emulator 使用 API R。 我知道我可以直接从 Android Studio 运行,但我仍然想在 Gradle 级别进行设置。

android {
    compileSdkVersion 30
    defaultConfig {
        applicationId "com.example.test"
        minSdkVersion 21
        targetSdkVersion 30
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

现在 Android 11(也称为 Android R)SDK 发布了,编译 SDK 版本只是30

android {
    compileSdkVersion 30

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

不再适用:

当 Android R 处于预览阶段时,编译 SDK 版本为'android-R' ,目标 SDK 版本为'R'

 android { compileSdkVersion 'android-R' defaultConfig { targetSdkVersion 'R' // Optional: If you want to target R as well // ... } // ... }

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM