![](/img/trans.png)
[英]gradle kotlin-dsl move android {} into subproject {} in root project build.gradle.kts
[英]Android Studio: How to access project level compileSdkVersion and targetSdkVersion in Kotlin Multiplatform shared module build.gradle.kts?
我正在嘗試將 KMM 共享模塊添加到我現有的 Android Studio 項目中。 我想在共享模塊中使用項目級別 build.gradle 的 compileSdkVersion 和 targetSdkVersion ,但我似乎無法使用它。
這是來自共享模塊build.gradle.kts的代碼片段:
android {
compileSdkVersion(30) // I want to use a project-wide variable here instead of '30'
defaultConfig {
minSdkVersion(23) // And here
targetSdkVersion(30) // And here
}
sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
}
我怎樣才能做到這一點?
您可以在buildSrc
中創建一個Dependencies/Versions
文件來指定可以被多個模塊重用的版本。
有關示例,請參閱https://github.com/joreilly/PeopleInSpace/blob/master/buildSrc/src/main/java/Dependencies.kt
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.