The project is using an unsupported version of Gradle

我的梦境 提交于 2021-02-07 19:53:20

问题


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']) 
}

回答1:


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.




回答2:


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.




回答3:


In the project build,gradle file Replace

runProguard false

With

minifyEnabled true


来源:https://stackoverflow.com/questions/27361337/the-project-is-using-an-unsupported-version-of-gradle

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!