为什么我得到“不受支持的 Gradle 版本"?使用 Android Studio 中的教程应用程序?

人气:655 发布:2022-10-16 标签: android-studio gradle metaio

问题描述

当我尝试将教程应用导入 Android Studio 时,我收到以下消息:

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

该项目正在使用不受支持的 Gradle 版本.

The project is using an unsupported version of Gradle.

请在项目的 Gradle 设置或项目的 Gradle 包装器(如果适用)中指出支持的 Gradle 版本.

Please point to a supported Gradle version in the project's Gradle settings or in the project's Gradle wrapper (if applicable.)

我是 Android Studio 的新手,我也是 Meter.Gradle 有什么问题?

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

我使用的是 Android Studio 1.0.1.

I’m using Android Studio 1.0.1.

推荐答案

Android Studio 1.0.1 支持 gradle 2.2.1+ 和 Android Gradle Plugin 1.0.0+

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

如何更改 gradle 版本.

在您的项目中,您应该有一个文件夹 gradle/wrapper.在里面你会找到 gradle-wrapper.properties 文件.

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

改里面的这一行

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

如何更改 gradle 插件版本:

在您的项目中,您应该在根文件夹中有一个 build.gradle 文件.

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

内部:

// 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'        
    }
}

注意.每个模块都有自己的 build.gradle 文件.在里面你可以覆盖默认配置.

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

更多信息此处.

123