使用Kotlin Gradle DSL的多模块应用需要添加以下插件和依赖项:
buildscript { repositories { google() jcenter() } dependencies { classpath("com.android.tools.build:gradle:4.2.2") classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.0") } }
android { ... } plugins { id("kotlin-android") }
subprojects {
apply(plugin = "org.jetbrains.kotlin.jvm")
configurations["implementation"].dependencies.add(
project(":backend-publishing")?.kotlin("stdlib-jdk8"))
repositories {
mavenCentral()
}
group = "com.example.company"
version = "1.0"
tasks.withType
dependencies { implementation(kotlin("stdlib-jdk8")) implementation("com.microsoft.appcenter:appcenter-analytics:4.0.0") implementation("com.microsoft.appcenter:appcenter-crashes:4.0.0") }
在完成以上步骤之后,Kotlin DSL的多模块应用就可以像Java DSL一样获得App Center的支持了。