简体   繁体   中英

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:

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

You need to update your cordova-android platform. Looks like the gradle build structure in the older platform is not compatible with android gradle version you are using. Current version seems to be 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

cordova-android 7 is not compatible with crosswalk, so you'll have to downgrade to 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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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