In this Android Tutorial, we shall see how to fix Android Gradle Error Minimum supported Gradle version is 4.0-rc-1. Current version is 4.0-milestone-1.

The same method also helps when Android Studio shows a similar message such as Minimum supported Gradle version is 6.1.1. Current version is 5.6.4, or any other pair of Gradle versions. The version numbers may be different, but the file to check is usually the Gradle Wrapper configuration file.

Why Android Studio shows the minimum supported Gradle version error

An Android project uses the Android Gradle Plugin together with a Gradle distribution. If the Android Gradle Plugin used in the project requires a newer Gradle version than the one configured in the wrapper, Gradle sync fails and Android Studio displays a minimum supported Gradle version error.

For this specific error, the project is trying to use Gradle 4.0-milestone-1, but the build requires at least Gradle 4.0-rc-1. Therefore, the fix is to update the Gradle distribution URL from gradle-4.0-milestone-1 to gradle-4.0-rc-1.

File to edit for the Gradle minimum supported version fix

gradle-wrapper.properties  under Gradle Scripts is the file that has to be modified.

In Android Studio, open the project and look for the following file.

</>
Copy
Gradle Scripts > gradle-wrapper.properties

In the project folder, the same file is usually available at the following path.

</>
Copy
gradle/wrapper/gradle-wrapper.properties

Current gradle-wrapper.properties using 4.0-milestone-1

As the error says that Current version is 4.0-milestone-1, this is the version that is present in the gradle-wrapper.properties file. The contents of the file would be as shown in the following.

gradle-wrapper.properties

#Mon Jun 26 14:52:01 IST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-milestone-1-all.zip

Change distributionUrl to gradle-4.0-rc-1

To fix the error, change the Gradle version in the field distributionUrl to gradle-4.0-rc-1, as shown in the following.

gradle-wrapper.properties

#Mon Jun 26 14:55:17 IST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-rc-1-all.zip

Save the file after changing the distributionUrl. Then run Gradle Sync again from Android Studio.

How to apply the same fix for other minimum supported Gradle version messages

If your error message shows different version numbers, do not copy 4.0-rc-1 blindly. Read the version mentioned after Minimum supported Gradle version is and use that Gradle version in distributionUrl.

For example, if Android Studio says that the minimum supported Gradle version is 6.1.1 and the current version is 5.6.4, update the wrapper URL to use gradle-6.1.1.

</>
Copy
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip

The general pattern is shown below.

</>
Copy
distributionUrl=https\://services.gradle.org/distributions/gradle-<required-version>-all.zip

Run Gradle sync after changing the wrapper version

After updating gradle-wrapper.properties, click Sync Now in Android Studio. You may also run the following command from the project root to check the Gradle version used by the wrapper.

</>
Copy
./gradlew --version

On Windows Command Prompt, use the following command instead.

</>
Copy
gradlew.bat --version

If the project downloads the new Gradle distribution and sync completes, the minimum supported Gradle version error is resolved.

Checks when Gradle sync still fails after updating distributionUrl

If Gradle sync still fails, check these project-specific points before changing more files.

  • Make sure the distributionUrl version exactly matches or is newer than the minimum version shown in the error.
  • Check that the URL still ends with a valid Gradle ZIP file name, such as gradle-4.0-rc-1-all.zip.
  • Confirm that you edited gradle/wrapper/gradle-wrapper.properties in the same project that Android Studio is syncing.
  • If Android Studio asks to use a recommended Gradle or Android Gradle Plugin version, review the suggested version before applying it.
  • If the failure changes to a different error, read the new error separately. The original minimum supported Gradle version problem may already be fixed.

FAQ on Android minimum supported Gradle version error

How do I change the minimum supported Gradle version in Android Studio?

You do not directly change the minimum supported version. The minimum version is required by the Android Gradle Plugin. You fix the error by updating the Gradle Wrapper version in gradle-wrapper.properties so that the project uses the required Gradle version or a compatible newer version.

Which line should I edit in gradle-wrapper.properties?

Edit only the distributionUrl line for this fix. In this tutorial, the old URL contains gradle-4.0-milestone-1-all.zip, and it is changed to gradle-4.0-rc-1-all.zip.

Should I use gradle-4.0-rc-1-all.zip or gradle-4.0-rc-1-bin.zip?

Both are Gradle distributions, but Android Studio projects commonly use the -all distribution because it includes additional files such as sources and documentation. To make the smallest change for this error, keep the existing suffix and only change the Gradle version part.

Will deleting the Gradle cache fix the minimum supported Gradle version error?

Deleting cache is usually not the first fix for this error. The main issue is the version configured in distributionUrl. Update the wrapper version first, sync the project, and clear cache only if the distribution download or local Gradle files appear corrupted.

Why does the same Android project build on one computer but fail on another?

This can happen when one setup uses a different Gradle installation or has already downloaded a compatible wrapper distribution. The reliable fix is to keep the correct Gradle Wrapper version in the project so all developers and build systems use the same expected Gradle version.

Editorial QA checklist for this Gradle error fix

  • The tutorial identifies gradle-wrapper.properties as the file to edit.
  • The specific error pair 4.0-rc-1 and 4.0-milestone-1 is handled without changing the original example code blocks.
  • The article explains how to adapt the fix when Android Studio shows other Gradle version numbers.
  • The commands for checking Gradle version use valid PrismJS language classes.
  • The FAQ answers are specific to Android Gradle Wrapper and minimum supported Gradle version errors.

This should fix the Gradle Error and now try again with the Gradle Sync. In this tutorial, we have learnt how to fix the Android Gradle error by updating the Gradle Wrapper version used by the Android project.