如此处所述:https://docs.fabric.io/android/beta/gradle.html
我曾经在 Android 应用程序的 build.gradle 中使用这两行代码将构建上传到 Fabric Beta,并使用给定组别名的给定发行说明:
android {
defaultConfig {
ext.betaDistributionReleaseNotesFilePath = 'app/release_notes.txt'
ext.betaDistributionGroupAliasesFilePath = 'app/group_aliases.txt'
}
}
将 build.gradle 文件迁移到 Kotlin Gradle DSL 后,这两行变为:
android {
defaultConfig {
ext.set("betaDistributionReleaseNotesFilePath", "app/release_notes.txt")
ext.set("betaDistributionGroupAliasesFilePath", "app/group_aliases.txt")
}
}
但它们不再有效:所有发布到 Fabric Beta 的构建都带有空白的发行说明,并且没有组别名。
我尝试了几种替代语法来设置额外的属性:
val betaDistributionReleaseNotesFilePath by extra { "app/release_notes.txt" }
或
ext["betaDistributionReleaseNotesFilePath"] = "app/release_notes.txt")
或
extra.set("betaDistributionReleaseNotesFilePath", "app/release_notes.txt")
或
project.ext.set("betaDistributionReleaseNotesFilePath", "app/release_notes.txt")
但结果不会改变。
添加并运行定义为的调试任务:
tasks.create("myTask") {
dependsOn("assembleDebug", "crashlyticsUploadDistributionDebug")
doLast {
val a = ext["betaDistributionReleaseNotesFilePath"]
val b = ext["betaDistributionGroupAliasesFilePath"]
println("ReleaseNotes: $a")
println("GroupAliases: $b")
}
}
打印:
ReleaseNotes: app/release_notes.txt
GroupAliases: app/group_aliases.txt
仅当使用 project.ext.set()
设置了额外的属性,但上传的构建仍然有空白的发行说明且没有组别名时。
我哪里错了?
最佳答案
你可以使用:
configure<CrashlyticsExtension> {
betaDistributionReleaseNotes = "xxx"
}
关于android - Fabric Beta 发行说明和 Gradle Kotlin DSL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52891699/