Lin*_*182 7 android android-gradle-plugin gradle-kotlin-dsl
旧的 apk 命名方式不再有效,AGP 8+ 中是否还有其他 api?
这是我的 kts build.config:
android {
...
applicationVariants.all { variant ->
variant.outputs
// default type don't have outputFileName field
.map { it as com.android.build.gradle.internal.api.ApkVariantOutputImpl }
.all { output ->
output.outputFileName = "MyAwesomeName.apk"
false
}
}
}
Run Code Online (Sandbox Code Playgroud)
我使用 AGP 8.1.0 和 gradle 8.2.1
发现问题:方法多了.all(),正确的来自org.gradle.api.DomainObjectCollection而不是来自_Collections.kt
基本上,为了获得正确的行为,我们只需删除itlambda 参数即可。
// wrong
applicationVariants.all { variant -> }
// right
applicationVariants.all { }
Run Code Online (Sandbox Code Playgroud)
非常棘手的问题
| 归档时间: |
|
| 查看次数: |
1234 次 |
| 最近记录: |