gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-03 13:44:54 26 4
gpt4 key购买 nike

我可以通过 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
// ...
}
// ...
}

关于android - 在 Android Studio 的 build.gradle 中设置的 Android R/11 的 API 级别是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60389498/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com