Why am I getting “unsupported version of Gradle” with the tutorials app in Android Studio?

不想你离开。 提交于 2019-12-22 08:19:07

问题


When I try to import the tutorials app to Android Studio, I get this message:

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.)

I’m new to Android Studio, and meter too. What’s the problem with Gradle?

I’m using Android Studio 1.0.1.


回答1:


Android Studio 1.0.1 supports gradle 2.2.1+ and Android Gradle Plugin 1.0.0+

How to change the gradle version.

In your project you should have a folder gradle/wrapper. Inside you will find the gradle-wrapper.properties file.

Change this line inside

distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip

How to change gradle plugin version:

In your project you should have a build.gradle file in the root folder.

Inside:

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        jcenter()   // or mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:1.0.0'        
    }
}

Pay attention. Each module has a own build.gradle file. Inside you can override the default configuration.

More info here.




回答2:


I too have faced this issue, To resolve this issue there are two things you need to try.

  1. You need to remember exactly what version of gradle distribution url you were adding to your existing project.

  2. if you didn't remember, you have to goto https://services.gradle.org/distributions/ and do trial and error. Add all versions to gradle distribution url like shown below.

distributionUrl=https://services.gradle.org/distributions/gradle-2.2.1-all.zip

only change the last version number 2.2.1-all to 3.5-all and so on.




回答3:


In gradle-wrapper.properties, modify the gradle version. Change to a newer one. The reason is generally: gradle and JDK, different versions are not compatible. Change the JDK to the old version.



来源:https://stackoverflow.com/questions/27993190/why-am-i-getting-unsupported-version-of-gradle-with-the-tutorials-app-in-andro

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