在0.14.0 android gradle插件升级后,我的项目因以下错误而停止构建:构建脚本错误,找到了不受支持的Gradle DSL方法:'renderscriptSupportMode()。在http://tools.android.com/tech-docs/new-build-system上查看发行说明后,我做了以下必要的更改:
Renamed a few properties to make things more consistent.
BuildType.runProguard -> minifyEnabled
BuildType.zipAlign -> zipAlignEnabled
BuildType.jniDebugBuild -> jniDebuggable
BuildType.renderscriptDebug -> renderscriptDebuggable
ProductFlavor.renderscriptSupportMode -> renderscriptSupportModeEnabled
ProductFlavor.renderscriptNdkMode -> renderscriptNdkModeEnabled
更改了上述属性后,一些错误消失了,但是我仍然在吼叫:
Could not find property 'zipAlignEnabled' on com.android.build.gradle.internal.api.ApplicationVariantImpl_Decorated
是否有人遇到此错误或让我知道我是否缺少某些东西?以下是导致错误的gradle.build片段。
if (variant.zipAlignEnabled) {
def file = variant.outputFile
def fileName = file.name.replace(".apk", "-" + majorCode + "." + minorCode + "." +miniCode + "-" +buildNumber+".apk")
variant.outputFile = new File(file.parent, fileName)
}
你试过了吗:
if (variant.buildType.zipAlignEnabled) { ...
(奖金):您还可能会遇到以下麻烦:
variant.outputFile = ...
如果是这样,您可能会发现以下链接有用:Gradle警告:不建议使用variant.getOutputFile()和variant.setOutputFile()
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句