使用Cordovabuild编译失败显示这个错误

img

使用Cordova build后无法成功显示如图错误 尝试过更换gradle版本 无济于事

  • 这篇文章:第一次执行Cordova build android失败原因一则 也许有你想要的答案,你可以看看
  • 除此之外, 这篇博客: Cordova开发篇中的 扩展 build.gradle 文件 部分也许能够解决你的问题, 你可以仔细阅读以下内容或跳转源博客中阅读:
  • 如果您需要自定义 build.gradle 文件,您应该创建一个名为build-extras.gradle的兄弟文件。此文件必须放在android平台目录( / platforms / android)中,因此建议您通过附加到before_build挂钩的脚本将其复制。

    一个例子如下:

    // Example build-extras.gradle
    // This file is included at the beginning of `build.gradle`
    ext.cdvDebugSigningPropertiesFile = '../../android-debug-keys.properties'
    
    // When set, this function allows code to run at the end of `build.gradle`
    ext.postBuildExtras = {
        android.buildTypes.debug.applicationIdSuffix = '.debug'
    }
    

    请注意,插件还可以通过以下方式包含build-extras.gradle文件:

    <framework src="some.gradle" custom="true" type="gradleReference" />