Minimum Supported Gradle Version Error in Studio
Android Studio is Google's flagship Integrated Development Environment (IDE) for app development. Along with the Android Software Development Kit (SDK) Google is constantly releasing new versions as the Android Operating System (OS) develops. Studio uses the Gradle build tool. Newer versions of Gradle can be developed before Studio's default Gradle configuration gets an update. This means Studio can sometimes report Gradle errors when opening old projects, importing old projects or using later version wildcards (+) in build scripts. This article discusses the error Minimum Supported Gradle Version.
Here is an example of the error Minimum Supported Gradle Version being displayed in Studio after a project import. It can also occur when opening a project after a Studio update.
Here is a build.gradle file for the project that displayed this error:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:+'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Notice the + in the line classpath 'com.android.tools.build:gradle:+'
, this requests that the latest available version should be used. Sometimes a project should use a specific version, sometimes this does not matter and the latest version can be used (hence the +). However, if a newer version of Gradle is available and Studio has not been updated to use it then a version mismatch can occur when using +. To view the distributionUrl mentioned in the error message open the file gradle-wrapper.properties:
#Mon Dec 28 10:00:20 PST 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
To clear the error replace the + with a version number that allows Studio to use a supported version of Gradle. An easy way to find Studio's default settings is simply to creat a new project. Use the File->New->New Project menu to create a new app.
Use Open Module Settings to View Default Configuration
Use the context menu (normally right-click) on the app in the Project explorer to select Open Module Settings.
The same options can be accessed via the toolbar.
The default configuration for Studio can be seen in the Project option:
The same settings can be applied to the project with the Minimum Supported Gradle Version error.
Check Studio's Settings
Another check is in Studio's settings. Us the File->Settings menu option.
Check that Use default gradle wrapper (recommended) is chosen.
Optionally Syncing Gradle or Invalidate Caches
Once the Gradle configuration changes have been made the Minimum Supported Gradle Version error should disappear. There may be a request to sync Gradle, which can also be done via the toolbar icon Sync Project with Gradle Files:
Some Studio users have needed to use Invalidate Caches / Restart option from the File Menu.
See Also
Author:Daniel S. Fowler Published: