[英]What is difference between compileSdk and compileSdkVersion in android studio gradle script when using jetpack compose
When I created new android project with jetpack compose toolkit with or without kotlin dsl I found that in module level build.gradle file the property compileSdkVersion has been replaced by compileSdk.当我使用带有或不带有 kotlin dsl 的 jetpack compose工具包创建新的 android 项目时,我发现在模块级别 build.gradle 文件中,属性 compileSdkVersion 已被 compileSdkVersion 替换。 I also found that android sdk version "android-S" couldn't be added to compileSdk for that compileSdkVersion = "android-S" needed to be added seperately.
我还发现无法将 android sdk 版本“android-S”添加到 compileSdk 中,因为需要单独添加 compileSdkVersion =“android-S”。 My question is what exactly is difference between compileSdk and compileSdkVersion .
我的问题是compileSdk和compileSdkVersion之间到底有什么区别。
build.gradle.kts(Module:Compose.app)
build.gradle.kts(模块:Compose.app)
android {
compileSdk = 30
buildToolsVersion = "30.0.3"
compileSdkVersion = "android-S"
}
With the new Android Gradle Plugin 7.0.0
(currently 7.0.0-alpha14
) you can use:使用新的 Android Gradle 插件
7.0.0
(当前7.0.0-alpha14
),您可以使用:
minSdk
instead of minSdkVersion
minSdk
而不是minSdkVersion
targetSdk
instead of targetSdkVersion
targetSdk
而不是targetSdkVersion
compileSdk
instead of compileSdkVersion
compileSdk
而不是compileSdkVersion
These attributes work with an Int
and you can use them with something like:这些属性与
Int
一起使用,您可以将它们与以下内容一起使用:
//minSdkVersion 21
//targetSdkVersion 30
minSdk 21
targetSdk 30
If you want to use a preview version you have to use:如果要使用预览版,则必须使用:
These attributes work with a String
and setting these values will override previous values of minSdk
/ targetSdk
/ compileSdk
.这些属性与
String
一起使用,设置这些值将覆盖minSdk
/ targetSdk
/ compileSdk
的先前值。
About the String format of the preview versions currently ( 7.0.0-alpha14
) it is not clear.关于当前预览版本(
7.0.0-alpha14
)的字符串格式尚不清楚。 Maybe it will change with 7.0.0-beta01
(you can check this commit ) and it should be:也许它会随着
7.0.0-beta01
改变(你可以检查这个 commit ),它应该是:
compileSdkPreview = "S"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.