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

1 Answer 1

4

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() } } 
Sign up to request clarification or add additional context in comments.

2 Comments

Oh, so easy! I thought everything in the top level build file was valid for the projects, too. Thanks!
@MaxGyver You can also add it in the top level build.gradle file. I've update the answer.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.