Reputation: 2739
I have started using Android Studio 1.0.2 and I am trying to add Library dependency. For example I am adding loopj library in my project.
Steps which I follow:
File > Project Structure > Module(app) > Dependencies tab > Click on + icon > select loopj library > Apply > OK
Now I am getting issue of Gradle project sync failed. Message : Failed to find: com.loopj.android:android-async-http:1.4.6
Somebody else facing the same problem? Please provide me suggestion if any.
Other information
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.test.testapplication"
minSdkVersion 14
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.loopj.android:android-async-http:1.4.6'
}
//
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
//
distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists distributionUrl=https://services.gradle.org/distributions/gradle-2.2.1-all.zip
Upvotes: 1
Views: 2163
Reputation: 1
I've faced the same problem. The solution was simple, all you need is upgrade your gradle version. To do this, open your build.gradle (root project) and edit the next line:
classpath 'com.android.tools.build:gradle:1.0.0'
to
classpath 'com.android.tools.build:gradle:1.1.0'
So if you are using Android Studio you will notice that you are using offline mode that's not available in the new gradle version. Confirm the change and now you can download the dependencies you want.
Upvotes: 0