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.
My gradle files are as follows:
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
Module Gradle:
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:
// 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()
}
}
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.
Thanks
Since you're using compileSdkVersion = 23
, you need to use support libraries of version starting with 23 as well. That's com.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.
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
Newest build tools are "23.0.2"
. Update the value in your modules' build.gradle
files.
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'
While at it the Android build plugin is missing in there altogether!
classpath 'com.android.tools.build:gradle:2.0.0'
Your apt plugin is old. Newest version is 1.8.
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
Your OkHttp library is old. Newest versions are 2.7.5 or 3.2.0.
compile 'com.squareup.okhttp:okhttp:2.7.5'