简体   繁体   中英

Gradle error: Could not find org.apache.httpcomponents:httpclient-android:4.3.5.1

I'm trying do use the Apache httpclient for Android in my Gradle project and I don't understand why I get this error when running ./gradle build :

Could not find org.apache.httpcomponents:httpclient-android:4.3.5.1.

My top-level build.gradle contains:

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.12.+'
    }
}

My project build.gradle starts with:

apply plugin: 'com.android.application'

dependencies {
    compile group: 'org.apache.httpcomponents' , name: 'httpclient-android' , version: '4.3.5.1'
    compile fileTree(dir: 'libs', include: '*.jar')
    compile project(':workspace:google_play_services:libproject:google-play-services_lib')
}

What's wrong with that?

In The Central Repository Browser of Maven the package I need is listed: http://search.maven.org/#browse|-305040853

You have to add in your project build.gradle

 repositories {
        mavenCentral()
 }

If you would like to put it in the top level file you can add this in the top level build.gradle :

allprojects {
     repositories {
        mavenCentral()
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM