【发布时间】:2014-09-27 07:55:06
【问题描述】:
刚刚将我的 android 项目更新为最新的 android gradle 插件并更改了脚本,因为有一些不推荐使用的方法。但是,当我尝试构建项目时,我得到了argument type mismatch 错误。我在尝试更改outputfile 名称时发现有问题,以下是'build.gradle' 中脚本的一部分:
android.applicationVariants.all { variant ->
def apkName = target;
if (variant.buildType.name == "release") {
apkName += "-RELEASE.apk";
} else {
apkName += "-DEBUG.apk"
}
// this is the line caused type mismatch error
variant.outputs.outputFile = file("$project.buildDir/outputs/apk/" + apkName)
}
我尝试更改为
variant.outputs.outputFile = "$project.buildDir/outputs/apk/" + apkName
但它不起作用。
如何解决?
【问题讨论】: