前言

今天打开Android Studio 提示我gradle版本太低了,升级一下gradle吧

Minimum supported Gradle version is 6.5. Current version is 6.4.

Please fix the project's Gradle settings.
Fix Gradle wrapper and re-import project
Open Gradle wrapper properties
Gradle Settings.

环境说明

  • mac
  • gradle 6.4 升级到 gradle 6.9

步骤说明

下载安装

点击官网下载

解压移动到你的安装目录

我这里是解压到了usr/local/gradle目录中

$ pwd
/usr/local/gradle

# axin @ AxindeMacBook-Pro in /usr/local/gradle [22:34:30]
$ ll
total 0
drwxr-xr-x@ 8 axin staff 256B 2 1 1980 gradle-6.4
drwxr-xr-x 8 axin wheel 256B 2 1 1980 gradle-6.9

修改配置

$ vim .bash_profile

# gradle
export GRADLE_HOME=/usr/local/gradle/gradle-6.9
export PATH=$PATH:$GRADLE_HOME/bin

source .bash_profile

查看结果

终端输入

gradle -v

# axin @ AxindeMacBook-Pro in ~ [22:23:53]
$ gradle -v

Welcome to Gradle 6.9!

Here are the highlights of this release:
- This is a small backport release.
- Java 16 can be used to compile when used with Java toolchains
- Dynamic versions can be used within plugin declarations
- Native support for Apple Silicon processors

For more details see https://docs.gradle.org/6.9/release-notes.html


------------------------------------------------------------
Gradle 6.9
------------------------------------------------------------

Build time: 2021-05-07 07:28:53 UTC
Revision: afe2e24ababc7b0213ccffff44970aa18035fc0e

Kotlin: 1.4.20
Groovy: 2.5.12
Ant: Apache Ant(TM) version 1.10.9 compiled on September 27 2020
JVM: 1.8.0_231 (Oracle Corporation 25.231-b11)
OS: Mac OS X 10.14.5 x86_64