简体   繁体   中英

Minimum supported Gradle version is 4.6. Current version is 4.1

by mistake, I deleted the android platform of my ionic project, and when I reinstalled it, it marked me error when running cordova build --release android

this is my ionic info

Ionic:

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

System:

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

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

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

You should need to remove the android platform again and please install 6.4.0 version. Its helpful to resolve that problem or you can upgrade gradle version in gradle-wrapper file.

For add Android 6.4.0 version run below command :

ionic cordova platform add android@6.4.0

Adding to the previous answer, here is the documentation for the Cordova Android Platform Guide. This will tell you the versions and Supported Versions as well as the Gradle version information. So removing and redownloading the proper Android Platform version with help with this.

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