支持的最低Gradle版本是4.6。当前版本是4.1

时间:2019-06-05 00:00:36

标签: android ionic-framework gradle

由于错误,我删除了离子项目的android平台,当我重新安装它时,它在运行cordova build --release android时将我标记为错误

这是我的离子信息

离子:

ionic (Ionic CLI)             : 4.12.0 (/usr/local/lib/node_modules/ionic)
Ionic Framework               : @ionic/angular 4.4.2
@angular-devkit/build-angular : 0.12.4
@angular-devkit/schematics    : 7.2.4
@angular/cli                  : 7.2.4
@ionic/angular-toolkit        : 1.4.1

科尔多瓦:

cordova (Cordova CLI) : 9.0.0 (cordova-lib@9.0.1)
Cordova Platforms     : android 6.4.0, browser 6.0.0, ios 5.0.1
Cordova Plugins       : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 3.1.2, (and 7 other plugins)

系统:

Android SDK Tools : 26.1.1 (/Users/usuario/Library/Android/sdk)
NodeJS            : v10.15.3 (/usr/local/bin/node)
npm               : 6.4.1
OS                : macOS Mojave

MacBook-Air-de-Usuario:HogApp_29_mayo_2019 usuario$ cordova build --release android
ANDROID_HOME=/Users/usuario/Library/Android/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_211.jdk/Contents/Home
Subproject Path: CordovaLib

失败:构建失败,并出现异常。

* Where:
Build file '/Users/usuario/Desktop/HogApp_29_mayo_2019/platforms/android/build.gradle' line: 20

* What went wrong:
A problem occurred evaluating root project 'android'.
> Failed to apply plugin [id 'com.android.application']
   > Minimum supported Gradle version is 5.1.1. Current version is 4.1. If using the gradle wrapper, try editing the distributionUrl in /Users/usuario/Desktop/HogApp_29_mayo_2019/gradle/wrapper/gradle-wrapper.properties to gradle-5.1.1-all.zip

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

* Get more help at https://help.gradle.org

BUILD FAILED in 2s
/Users/usuario/Desktop/HogApp_29_mayo_2019/platforms/android/gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.

* Where:
Build file '/Users/usuario/Desktop/HogApp_29_mayo_2019/platforms/android/build.gradle' line: 20

* What went wrong:
A problem occurred evaluating root project 'android'.
> Failed to apply plugin [id 'com.android.application']
   > Minimum supported Gradle version is 5.1.1. Current version is 4.1. If using the gradle wrapper, try editing the distributionUrl in /Users/usuario/Desktop/HogApp_29_mayo_2019/gradle/wrapper/gradle-wrapper.properties to gradle-5.1.1-all.zip

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

* Get more help at https://help.gradle.org

2 个答案:

答案 0 :(得分:0)

您应该再次删除android平台,然后安装6.4.0版本。它有助于解决该问题,或者您可以在gradle-wrapper文件中升级gradle版本。

要添加Android 6.4.0版本,请运行以下命令:

ionic cordova平台添加android@6.4.0

答案 1 :(得分:0)

除了上一个答案外,here是《 Cordova Android平台指南》的文档。这将告诉您版本和支持的版本以及Gradle版本信息。因此,在此帮助下,删除并重新下载正确的Android平台版本。