当离子cordova在Mac 10.x上构建android时gradle失败

时间:2017-12-28 14:56:59

标签: android macos cordova ionic-framework android-gradle

尝试在Mac v10.x上构建离子项目ionic cordova build android时出现此错误:

Subproject Path: CordovaLib 

Configuration 'compile' in project ':' is deprecated. Use 'implementation' instead.
null

The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.

at build_1v81ywijexel39ggzi5morld0.run(<Userspath>/platforms/android/build.gradle:143)
org.xwalk:xwalk_core_library:23+
FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'android'.

> 

All flavors must now belong to a named flavor dimension. Learn more at https://d.android.com/r/tools/flavorDimensions-missing-error-message.html

该错误表明它是Gradle问题。有人遇到这个问题并且能够解决问题吗?我该怎么办?

------------------------------------------------------------
Gradle 4.4.1
------------------------------------------------------------

Build time:   2017-12-20 15:45:23 UTC
Revision:     10ed9dc355dc39f6307cc98fbd8cea314bdd381c

Groovy:       2.4.12
Ant:          Apache Ant(TM) version 1.9.9 compiled on February 2 2017
JVM:          1.8.0_161 (Oracle Corporation 25.161-b12)
OS:           Mac OS X 10.13.2 x86_64

使用Ionic v3.19.x和Cordova v7.1.0,并更新Cordova v8.0肯定无法解决此问题,同时使用cordova-android v6.2.3

3 个答案:

答案 0 :(得分:2)

您需要更新cordova-android平台。看起来旧平台中的gradle构建结构与您正在使用的android gradle版本不兼容。当前版本似乎是7.0.0

ionic cordova platform add android@latest

修改  请注意,如果您打算按照其他答案降级,则不再维护Crosswalk项目/插件

答案 1 :(得分:0)

cordova-android 7与人行横道不兼容,所以你必须降级到cordova-android 6.4.0。

我没有在发行说明中看到它,但在cordova-android 7.0.0发布邮件中提到过。

答案 2 :(得分:0)

我遇到了一个非常类似的错误,并最终通过以下操作解决了该错误: brew install gradle 我还必须为开发人员下载Java运行时的版本8。