Android Studio 1.0.2 m2respository gradle issue… here is a solution to the problem.
Android Studio 1.0.2 m2respository gradle issue
With Android Studio 1.0.2, Gradle 2.2.1 is enforced, and all system variables are correct. With the new update, there are problems with older versions of Gradle and M2Repository. I’m trying to import kickflip.io android example ( https://github.com/Kickflip/kickflip-android-example )。
I see this error :
Could not find com.android.tools.build:gradle:2.2.1.
Searched in the following locations:
file:/C:/Program Files/Android/Android Studio/gradle/m2repository/com/android/tools/build/gradle/2.2.1/gradle-2.2.1.pom
file:/C:/Program Files/Android/Android Studio/gradle/m2repository/com/android/tools/build/gradle/2.2.1/gradle-2.2.1.jar
https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.2.1/gradle-2.2.1.pom
https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.2.1/gradle-2.2.1.jar
Required by:
:kickflip-android-example-master:unspecified
I looked at m2repository and saw:
C:\Program Files\Android\Android Studio\gradle\m2repository\com\android\tools\build\gradle\1.0.0
How do I add a 2.2.1 library?
Gradient wrapper:
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=http\://services.gradle.org/distributions/gradle-2.2.1-all.zip
Top-level build files:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.1'
classpath 'org.codehaus.groovy:groovy-backports-compat23:2.3.5'
}
}
allprojects {
repositories {
mavenCentral()
}
}
Application/build.gradle:
buildscript {
repositories {
maven { url 'http://repo1.maven.org/maven2' }
}
}
android {
compileSdkVersion 19
buildToolsVersion "19.1"
defaultConfig {
minSdkVersion 18
targetSdkVersion 19
versionCode 2
versionName "1.1"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
dependencies {
compile 'com.android.support:support-v4:19.1.0'
compile 'com.squareup.picasso:picasso:2.2.0'
compile 'com.readystatesoftware.systembartint:systembartint:1.0.3'
compile 'io.kickflip:sdk:1.1.1'
}
My bug report is very long, so won’t post it because the formatting breaks when I copy and paste it. Any help is greatly appreciated.
Solution
The version of Gradle is
2.2.1, but you insert it where the Android Gradle plugin version number is. It is currently 1.0.0. And not this :
classpath 'com.android.tools.build:gradle:2.2.1'
Use this:
classpath 'com.android.tools.build:gradle:1.0.0'