android - Ionic Android 支持的最低 Gradle 版本为 4.6。当前版本是 4.1
问题描述
我运行命令:“$ionic cordova build android”但我会得到这个错误。你知道如何解决这个错误吗?
Preparing Firebase on Android
ANDROID_HOME=/Users/henriaycard/Library/Android/sdk
JAVA_HOME=/Users/henriaycard/Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home
studio
Subproject Path: CordovaLib
Subproject Path: app
FAILURE: Build failed with an exception.
* Where:
Build file '/Users/henriaycard/git/ionic/upsudEvenement/platforms/android/CordovaLib/build.gradle' line: 41
* What went wrong:
A problem occurred evaluating project ':CordovaLib'.
>
Failed to apply plugin [id 'com.android.library']
>
Minimum supported Gradle version is 4.6. Current version is 4.1. If using the gradle wrapper, try editing the distributionUrl in /Users/henriaycard/git/ionic/upsudEvenement/gradle/wrapper/gradle-wrapper.properties to gradle-4.6-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 1s
(node:35261) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: /Users/henriaycard/git/ionic/upsudEvenement/platforms/android/gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
* Where:
Build file '/Users/henriaycard/git/ionic/upsudEvenement/platforms/android/CordovaLib/build.gradle' line: 41
* What went wrong:
A problem occurred evaluating project ':CordovaLib'.
> Failed to apply plugin [id 'com.android.library']
> Minimum supported Gradle version is 4.6. Current version is 4.1. If using the gradle wrapper, try editing the distributionUrl in /Users/henriaycard/git/ionic/upsudEvenement/gradle/wrapper/gradle-wrapper.properties to gradle-4.6-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 1s
(node:35261) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
[ERROR] An error occurred while running cordova run android (exit code 1).
解决方案
如果您使用的是 mac,请在 .bash_profile 中添加以下行并执行“source ~/.bash_profile”
export CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL="https\://services.gradle.org/distributions/gradle-4.7-all.zip"
推荐阅读
- c# - FileOpenPicker 在 Xbox One 上始终返回 null
- python - Python - 如何使函数内部使用的变量具有迭代值?
- reactjs - 第三方组件在尝试更新时将状态重置为初始值
- java - 如何在 JSP SQL Select 语句中传递来自控制器的employeeId?
- twitter-bootstrap - 折叠时看不到我的下拉按钮
- javascript - SVG 中的 ForeignObject 不起作用 - React
- javascript - 我的弹出窗口在页面顶部打开
- c++ - 覆盖虚函数不同于 C++
- sql - 如何在 SQLAlchemy 的关联表中添加一行?
- unity3d - Unity 2020.2.1f1 无标记 AR 插件