簡體   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