简体   繁体   English

使用jetpack compose时android studio gradle脚本中的compileSdk和compileSdkVersion有什么区别

[英]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 .我的问题是compileSdkcompileSdkVersion之间到底有什么区别

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 ),您可以使用:

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.

相关问题 在 android 中创建自定义视图和使用 jetpack compose 有什么区别 - what is the difference between creating custom view and using jetpack compose in android android studio 中 compileSdkVersion 和 buildToolsVersion 之间的区别..? - difference between compileSdkVersion and buildToolsVersion in android studio..? android jetpack compose中的“remember”和“mutableState”有什么区别? - What is the difference between "remember" and "mutableState" in android jetpack compose? observeAsState 和 collectAsState 之间的区别以及何时在 Android Jetpack Compose 中使用它们? - Difference between observeAsState and collectAsState and when to use each in Android Jetpack Compose? minCompileSdk 和 compileSdk 的区别 - Difference between minCompileSdk and compileSdk compileSdkVersion 和 targetSdkVersion 有什么区别? - What is the difference between compileSdkVersion and targetSdkVersion? Android Jetpack Compose:_uiState 和 uiState 有什么区别,我应该在 ViewModel 中阅读哪一个? - Android Jetpack Compose: what is the difference between _uiState and uiState and which one should I read in ViewModel? 在jetpack compose中分配remember时=运算符和保留字有什么区别 - What is the difference between the = operator and the reserved word by when assigning a remeber in jetpack compose 在 Jetpack Compose 中的分配和委派中使用记住有什么区别? - What's the difference between using remember in assignment vs in delegation in Jetpack Compose? Jetpack Compose 中 Box 内组件中的 `fillMaxSize()` 和 `matchParentSize()` 之间有什么区别? - What is the difference between `fillMaxSize()` and `matchParentSize()` in a component inside a Box in Jetpack Compose?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM