Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The project is using an unsupported version of Gradle

Tags:

android

gradle

I am following this tutorial in Android Studio.

When trying to Import the project, I get a dialog saying:

"The project is using an unsupported version of Gradle." Please point to a supported Gradle version in the project's Gradle settings or in the project's Gradle wrapper (if applicable.)"

It also fails if I select the wrapper method by stating: "Plugin with id 'com.android.application' not found.

Here is what Parse's gradle looks like:

apply plugin: 'com.android.application'

repositories {
    mavenCentral() }

dependencies {
    compile 'com.parse.bolts:bolts-android:1.1.3'
    compile fileTree(dir: 'libs', include: 'Parse-*.jar') }

android {
    compileSdkVersion rootProject.ext.compileSdkVersion
    buildToolsVersion rootProject.ext.buildToolsVersion

    defaultConfig {
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
    }

    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            res.srcDirs = ['res']
        }
    } 
}

My project's Gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.1"

    defaultConfig {
        applicationId "id.goes.here"
        minSdkVersion 19
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    } }

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar']) 
}
like image 685
Tiberius Avatar asked Dec 19 '22 08:12

Tiberius


2 Answers

You generally have two build.gradles in your project:

  • A top level build.gradle in your project's root that contains buildscript {} and allprojects {} sections. This contains the project-wide configuration.
  • An app module build.gradle (located in your app's module folder) that contains the configuration for your android application. This one contains the android {} section.

Open up your top level build.gradle, and look at the Android Gradle plugin version (it will look something like classpath 'com.android.tools.build:gradle:1.0.0-rc3').

If the plugin is at version 0.13.0 or higher, you need to make sure you are using Gradle 2.1 or newer. If the plugin is below version 0.14.4, you cannot use Gradle 2.2+.

Before going further, you need to find out whether you are using a local gradle distribution or the wrapper. To do so, go to File > Settings, then search for "Gradle." If "Use local Gradle distribution" is selected, either update your local Gradle to a supported version or switch to using the wrapper.

If you are using the wrapper, the configuration for the Gradle version is located under <your-project>/gradle/wrapper/gradle-wrapper.properties. This file contains a line that will look something like this: distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip . Simply change the version at the end to a supported version.

Studio typically will offer to update the wrapper for you if you click on the error telling you that it is not a supported version.

like image 64
Bryan Herbst Avatar answered Dec 26 '22 11:12

Bryan Herbst


I resolve this issue by syncing project with gradle files.

In android studio from menu open File option and click option sync project with gradle files.

like image 20
mehmoodnisar125 Avatar answered Dec 26 '22 11:12

mehmoodnisar125