在 com.android.build.gradle.internal.api.ApplicationVariantImpl 上找不到属性“outputFile" [英] Could not find property 'outputFile' on com.android.build.gradle.internal.api.ApplicationVariantImpl

查看:32
本文介绍了在 com.android.build.gradle.internal.api.ApplicationVariantImpl 上找不到属性“outputFile"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

更新到 AS 1.0 RC 1 和插件 0.14.4 后,我的 build.gradle 的重命名部分出现问题:

After updating to AS 1.0 RC 1 and plugin 0.14.4 I am having problems with the renaming part of my build.gradle:

applicationVariants.all { variant ->
            def file = variant.outputFile
            variant.outputFile = new File(file.parent, file.name.replace(".apk", "-" + defaultConfig.versionName + ".apk"))
        }

现在抛出:

Error:(78, 0) Could not find property 'outputFile' on com.android.build.gradle.internal.api.ApplicationVariantImpl_Decorated@67e7625f.

而且我也无法跳转到 ApplicationVariantImpl 类来查看该属性是如何被重命名的.有人知道解决方法吗?

and also I cannot jump to the class ApplicationVariantImpl to look how the property might have been renamed. Anyone knows workarounds for this?

推荐答案

试试这个

applicationVariants.all { variant ->
    variant.outputs.each { output ->
        def file = output.outputFile
        output.outputFile = new File(file.parent, file.name.replace(".apk", "-" + defaultConfig.versionName + ".apk"))
    }
}

这篇关于在 com.android.build.gradle.internal.api.ApplicationVariantImpl 上找不到属性“outputFile"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆