Solving Gradle update problem in Android Studio 0.4.2

January 21, 2014 at 02:43

Solving the Gradle update problem in Android Studio 0.4.2 will be shown in this short tutorial. A few days ago I was migrating my Android apps from the Eclipse ADT plugin to the new Android Studio when I encountered a frustrating problem with the Gradle plugin. After exporting my projects and modules to the Android Studio (preview) 0.4.2., I kept getting an error which prevented my projects and modules from being successfully exported into Android Studio by the Gradle plugin. The error read:
[enlighter lang=”text”]Gradle version 1.6 is required. Current version is 1.9. Please fix the project’s Gradle settings.
[/enlighter]

If you are having the same problem, you might also get a variation of the same error but with a different version number on the required Gradle version (…1.7 is required …, or … 1.8 is required …).

Solving the problem is simple and involves manually editing the build.gradle file in your project directory. You can find this file displayed in the project explorer on the left side view of Android Studio.

manually editing build.gradle in Android Studio preview 0.4.2

location of build.gradle file in project structure

What needs to be edited is the url pointing to the path of your Gradle build files. Make sure you update the url in the classpath line to point to Gradle 0.7.+ as shown below:

[enlighter lang=”java”]
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath ‘com.android.tools.build:gradle:0.9.+’
}
}
[/enlighter]

After updating the build.gradle file, make sure you save it and then restart Android Studio. When you reopen Android Studio, your imported project should compile succssfully. Let me know if it worked for you or not in the comments below.

Tags: