[Android][Gradle] Minimum supported Gradle version is 5.1.1. Current version is 4.10.2.

2019. 5. 6. 13:28Programing/Debugging

 

[Error Code]

Caused by: java.lang.RuntimeException: Minimum supported Gradle version is 5.1.1. Current version is 4.10.2. If using the gradle wrapper, try editing 
the distributionUrl in \Application\gradle\wrapper\gradle-wrapper.properties to gradle-5.1.1-all.zip 
        at com.android.build.gradle.BasePlugin.checkGradleVersion(BasePlugin.java:678) 
        at com.android.build.gradle.BasePlugin.basePluginApply(BasePlugin.java:256) 
        at com.android.build.gradle.BasePlugin.lambda$apply$0(BasePlugin.java:245) 
        at com.android.build.gradle.internal.crash.CrashReporting.runAction(crash_reporting.kt:27) 
        at com.android.build.gradle.BasePlugin.apply(BasePlugin.java:243) 
        at com.android.build.gradle.BasePlugin.apply(BasePlugin.java:136) 
        at org.gradle.api.internal.plugins.ImperativeOnlyPluginTarget.applyImperative(ImperativeOnlyPluginTarget.java:42) 
        at org.gradle.api.internal.plugins.RuleBasedPluginTarget.applyImperative(RuleBasedPluginTarget.java:50) 
        at org.gradle.api.internal.plugins.DefaultPluginManager.addPlugin(DefaultPluginManager.java:174) 
        at org.gradle.api.internal.plugins.DefaultPluginManager.access$300(DefaultPluginManager.java:50) 
        at org.gradle.api.internal.plugins.DefaultPluginManager$AddPluginBuildOperation.run(DefaultPluginManager.java:264) 
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:300) 
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:292) 
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:174) 
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90) 
        at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31) 
        at org.gradle.api.internal.plugins.DefaultPluginManager$2.execute(DefaultPluginManager.java:152) 
        at org.gradle.api.internal.plugins.DefaultPluginManager$2.execute(DefaultPluginManager.java:149) 
        at org.gradle.configuration.internal.DefaultUserCodeApplicationContext.apply(DefaultUserCodeApplicationContext.java:48) 
        at org.gradle.api.internal.plugins.DefaultPluginManager.doApply(DefaultPluginManager.java:149) 
        ... 112 more

 

[Problem 1]

Wrong version in gradle-wrapper.properties

[Solution 1]

Set correct version into gradle-wrapper.properties. If you don't know this, you can access at https://services.gradle.org

\Application\gradle\wrapper\gradle-wrapper.properties

distributionUrl=https://services.gradle.org/distributions/gradle-5.1.1-all.zip

불러오는 중입니다...

 

[Problem 2]

Target gradle version is less than installed version

>gradle --version

------------------------------------------------------------
Gradle 4.10.2
------------------------------------------------------------

Build time:   2018-09-19 18:10:15 UTC
Revision:     b4d8d5d170bb4ba516e88d7fe5647e2323d791dd

Kotlin DSL:   1.0-rc-6
Kotlin:       1.2.61
Groovy:       2.4.15
Ant:          Apache Ant(TM) version 1.9.11 compiled on March 23 2018
JVM:          1.8.0_191 (Oracle Corporation 25.191-b12)
OS:           Windows 10 10.0 amd64

[Solution 2]

1. Access https://services.gradle.org/distributions/

 

Gradle Distributions

 

services.gradle.org

2. Download latest version xxxxx-all.zip

3. Update manually

4. Check version

 

 

[Additional Info]

Installing Gradle

You can install the Gradle build tool on Linux, macOS, or Windows. This document covers installing using a package manager like SDKMAN!, Homebrew, or Scoop, as well as manual installation.

Use of the Gradle Wrapper is the recommended way to upgrade Gradle.

You can find all releases and their checksums on the releases page.

Prerequisites

Gradle runs on all major operating systems and requires only a Java JDK version 7 or higher to run. To check, run java -version. You should see something like this:

❯ java -version java version "1.8.0_151" Java(TM) SE Runtime Environment (build 1.8.0_151-b12) Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12, mixed mode)

Gradle ships with its own Groovy library, therefore Groovy does not need to be installed. Any existing Groovy installation is ignored by Gradle.

Gradle uses whatever JDK it finds in your path. Alternatively, you can set the JAVA_HOME environment variable to point to the installation directory of the desired JDK.

Installing with a package manager

SDKMAN! is a tool for managing parallel versions of multiple Software Development Kits on most Unix-based systems.

❯ sdk install gradle

Homebrew is "the missing package manager for macOS".

❯ brew install gradle

Scoop is a command-line installer for Windows inspired by Homebrew.

❯ scoop install gradle

Chocolatey is "the package manager for Windows".

❯ choco install gradle

MacPorts is a system for managing tools on macOS:

❯ sudo port install gradle

↓ Proceed to next steps

Installing manually

Step 1. Download the latest Gradle distribution

The distribution ZIP file comes in two flavors:

  • Binary-only (bin)

  • Complete (all) with docs and sources

Need to work with an older version? See the releases page.

Step 2. Unpack the distribution

Linux & MacOS users

Unzip the distribution zip file in the directory of your choosing, e.g.:

❯ mkdir /opt/gradle ❯ unzip -d /opt/gradle gradle-4.10.2-bin.zip ❯ ls /opt/gradle/gradle-4.10.2 LICENSE NOTICE bin getting-started.html init.d lib media

Microsoft Windows users

Create a new directory C:\Gradle with File Explorer.

Open a second File Explorer window and go to the directory where the Gradle distribution was downloaded. Double-click the ZIP archive to expose the content. Drag the content folder gradle-4.10.2 to your newly created C:\Gradle folder.

Alternatively you can unpack the Gradle distribution ZIP into C:\Gradle using an archiver tool of your choice.

Step 3. Configure your system environment

For running Gradle, firstly add the environment variable GRADLE_HOME. This should point to the unpacked files from the Gradle website. Next add GRADLE_HOME/bin to your PATH environment variable. Usually, this is sufficient to run Gradle.

Linux & MacOS users

Configure your PATH environment variable to include the bin directory of the unzipped distribution, e.g.:

❯ export PATH=$PATH:/opt/gradle/gradle-4.10.2/bin

Microsoft Windows users

In File Explorer right-click on the This PC (or Computer) icon, then click Properties  Advanced System Settings  Environmental Variables.

Under System Variables select Path, then click Edit. Add an entry for C:\Gradle\gradle-4.10.2\bin. Click OK to save.

↓ Proceed to next steps

Verifying installation

Open a console (or a Windows command prompt) and run gradle -v to run gradle and display the version, e.g.:

❯ gradle -v ------------------------------------------------------------ Gradle 4.10.2 ------------------------------------------------------------ Build time: 2018-02-21 15:28:42 UTC Revision: 819e0059da49f469d3e9b2896dc4e72537c4847d Groovy: 2.4.15 Ant: Apache Ant(TM) version 1.9.9 compiled on February 2 2017 JVM: 1.8.0_151 (Oracle Corporation 25.151-b12) OS: Mac OS X 10.13.3 x86_64

If you run into any trouble, see the section on troubleshooting installation.

You can verify the integrity of the Gradle distribution by downloading the SHA-256 file (available from the releases page) and following these verification instructions.

Next steps

Now that you have Gradle installed, use these resources for getting started:

Getting help

You might check the user guide at GRADLE_HOME/docs/userguide/userguide.html. It is also available on the Gradle web site. Typing gradle help prints the command line help. Typing gradle tasks shows all the tasks of a Gradle build.