如此处所述:https ://docs.fabric.io/android/beta/gradle.html
我曾经在 Android 应用程序的 build.gradle 中有这 2 行,用于将构建上传到 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()
,但上传的版本仍然有空白的发行说明并且没有组别名。
我怎么了?