Gradle同步失败:无法将Android插件更新到版本"2.0.0" [英] Gradle sync failed: Failed to update Android plugin to version '2.0.0'
问题描述
我最近将Android Studio更新为2.0.我正在做兼职课程,我必须从事提供的项目.当gradle尝试构建项目时,会弹出一个对话框,要求我更新android studio gradle插件.单击更新时,出现标题中的错误.
I've recently updated Android Studio to 2.0. I am working on a part time course and I have to work on a project provided. When gradle tried to build the project a dialog popped up asking me to update the android studio gradle plugin. When I clicked update, I got an error which is in the title.
我的gradle文件如下:
My gradle files are as follows:
Gradle Wrapper:
Gradle Wrapper:
#Wed Sep 30 11:56:02 PDT 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=http\://services.gradle.org/distributions/gradle-2.2-bin.zip
模块摇篮:
apply plugin: 'com.android.application'
apply plugin: 'android-apt'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.example.sam_chordas.stockhawk"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
maven { url "https://jitpack.io" }
}
dependencies {
compile 'com.google.android.gms:play-services-gcm:8.4.0'
compile 'com.squareup.okhttp:okhttp:2.5.0'
apt 'net.simonvt.schematic:schematic-compiler:0.6.3'
compile 'net.simonvt.schematic:schematic:0.6.3'
compile 'com.melnykov:floatingactionbutton:1.2.0'
compile 'com.android.support:design:23.1.1'
compile('com.github.afollestad.material-dialogs:core:0.8.5.7@aar') {
transitive = true
}
}
Project Gradle:
Project Gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.2'
classpath 'com.google.gms:google-services:1.4.0-beta3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
由于无法构建该项目,因此无法处理该项目.如果有人遇到任何类似问题并予以解决,我将非常感谢您的帮助,因为我要浪费大量时间.我应该提到这是Windows 7机器.
I'm unable to work on the project as I'm unable to build it. If anyone has had any issues like this and fixed it I'd really appreciate some help as I'm wasting a lot of time. I should mention that this is a windows 7 machine.
谢谢
推荐答案
-
由于使用的是
compileSdkVersion = 23
,因此还需要使用版本从23开始的支持库.在您的情况下为com.android.support:design:23.3.0
.它可能与手头的问题无关,但是稍后会为您节省运行时错误,因此请尽快修复.
Since you're using
compileSdkVersion = 23
, you need to use support libraries of version starting with 23 as well. That'scom.android.support:design:23.3.0
in your case. It may be unrelated to the issue at hand but it will save you runtime errors later so fix it ASAP.
对于Android构建插件,您的gradle分发太旧了.在您的gradle/gradle-wrapper.properties
文件中使用它:
Your gradle distribution is too old for Android build plugin. Use this in your gradle/gradle-wrapper.properties
file:
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
最新的构建工具是"23.0.2"
.更新模块的build.gradle
文件中的值.
Newest build tools are "23.0.2"
. Update the value in your modules' build.gradle
files.
Google Play服务插件必须与Android构建插件具有相同的版本.至少它必须处于beta阶段,而且我认为主要版本在任何情况下都必须相对应.那是在您的项目 build.gradle
:
Google Play services plugin must be of the same version as Android build plugin. At least it had to be in beta stages and I imagine the major version has to correspond in any case. That's in your project build.gradle
:
classpath 'com.google.gms:google-services:2.0.0'
与此同时, Android构建插件完全丢失了!
classpath 'com.android.tools.build:gradle:2.0.0'
可选
-
您的apt插件较旧.最新版本是1.8.
Your apt plugin is old. Newest version is 1.8.
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
您的OkHttp库很旧.最新版本是2.7.5或3.2.0.
Your OkHttp library is old. Newest versions are 2.7.5 or 3.2.0.
compile 'com.squareup.okhttp:okhttp:2.7.5'
这篇关于Gradle同步失败:无法将Android插件更新到版本"2.0.0"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!