Android studio - Gradle版本是2.14.1。当前版本是2.10

时间:2016-11-04 15:21:02

标签: android gradle android-gradle

我无法在我的Mac中构建项目。这是由其他人编码并交给我的。我按照建议更改了我的gradle-wrapper.properties,但仍面临问题

Error:(1, 1) A problem occurred evaluating project ':app'.
 Failed to apply plugin [id 'com.android.application'] Minimum supported Gradle version is 2.14.1. Current version is 2.10. 
 If using the gradle wrapper, try editing the distributionUrl in /Users/*****/Downloads/android_project/gradle/wrapper/gradle-wrapper.properties to gradle-2.14.1-all.zip. 

下面是我的gradle-wrapper.properties文件

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.0-all.zip

Gradle同步输出也显示此错误,我无法解决 - 不确定它是否与上述内容有关

Error:(30, 13) Failed to resolve:   
com.android.support.constraint:constraint-layout:1.0.0-alpha4
<a href="install.m2.repo">Install Repository and sync project</a><br><a    
  href="openFile:/Users/*****/Downloads/android_project/app/build.gradle">
Show in File</a><br><a href="open.dependency.in.project.structure">
Show in Project Structure dialog</a>

2 个答案:

答案 0 :(得分:1)

您正在使用本地gradle分发。要改变它,请转到

Android Studio -> File -> Settings -> Build, Execution, Deployment -> Gradle -> Use default gradle wrapper

然后你将使用实际应该指向最新版本的gradle-wrapper.properties。

您可以看到here at gradle distributions

答案 1 :(得分:0)

distributionUrl错了。指向2.14.0版本。将其更改为:

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