简体   繁体   English

当 ionic cordova 在 Mac 10.x 上构建 android 时,gradle 失败

[英]gradle fails when ionic cordova build android on Mac 10.x

When trying to build an Ionic project ionic cordova build android on Mac v10.x I get this error:尝试在 Mac v10.x 上构建 Ionic 项目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

The error suggests it is a Gradle issue.该错误表明这是 Gradle 问题。 Anyone run into this and been able to solve the issue?任何人都遇到过这个问题并能够解决这个问题? What should I do?我该怎么办?

------------------------------------------------------------
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

Using Ionic v3.19.x and Cordova v7.1.0 , and updating Cordova v8.0 definitely doesn't resolve the issue, also using cordova-android v6.2.3使用 Ionic v3.19.x和 Cordova v7.1.0 ,并更新 Cordova v8.0绝对不能解决问题,也使用cordova-android v6.2.3

You need to update your cordova-android platform.您需要更新您的cordova-android平台。 Looks like the gradle build structure in the older platform is not compatible with android gradle version you are using.看起来旧平台中的 gradle 构建结构与您使用的 android gradle 版本不兼容。 Current version seems to be 7.0.0 .当前版本似乎是7.0.0

ionic cordova platform add android@latest

EDIT do note thatCrosswalk project /plugin is no longer maintained if you plan to downgrade as per the other answer编辑请注意,如果您打算按照其他答案进行降级,则不再维护Crosswalk项目 /plugin

cordova-android 7 is not compatible with crosswalk, so you'll have to downgrade to cordova-android 6.4.0. cordova-android 7 与 crosswalk 不兼容,因此您必须降级到cordova-android 6.4.0。

I don't see it mentioned in the release notes, but was mentioned in the cordova-android 7.0.0 release mail.我在发行说明中没有看到它,但在cordova-android 7.0.0 发布邮件中提到了它。

我遇到了一个非常相似的错误,并最终解决了它: brew install gradle我还必须为开发人员下载 java 运行时的第 8 版。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM