Gradle not finding org.apache.commons:commons-imaging - gradle

Gradle cannot resolve org.apache.commons:commons-imaging, yet it is available in all 3 of the provided repositories:
http://jump-pilot.sourceforge.net/repository
https://repo.adobe.com/nexus/content/repositories/public/
https://repository.apache.org/content/repositories/snapshots/
This part of the log is interesting, Gradle looks only in jcenter and the local filesystem:
https://jcenter.bintray.com/org/apache/commons/commons-imaging/1.0-SNAPSHOT/maven-metadata.xml
https://jcenter.bintray.com/org/apache/commons/commons-imaging/1.0-SNAPSHOT/commons-imaging-1.0-SNAPSHOT.pom
https://jcenter.bintray.com/org/apache/commons/commons-imaging/1.0-SNAPSHOT/commons-imaging-1.0-SNAPSHOT.jar
file:/Users/user/Library/Android/sdk/extras/android/m2repository/org/apache/commons/commons-imaging/1.0-SNAPSHOT/maven-metadata.xml
file:/Users/user/Library/Android/sdk/extras/android/m2repository/org/apache/commons/commons-imaging/1.0-SNAPSHOT/commons-imaging-1.0-SNAPSHOT.pom
file:/Users/user/Library/Android/sdk/extras/android/m2repository/org/apache/commons/commons-imaging/1.0-SNAPSHOT/commons-imaging-1.0-SNAPSHOT.jar
file:/Users/user/Library/Android/sdk/extras/google/m2repository/org/apache/commons/commons-imaging/1.0-SNAPSHOT/maven-metadata.xml
file:/Users/user/Library/Android/sdk/extras/google/m2repository/org/apache/commons/commons-imaging/1.0-SNAPSHOT/commons-imaging-1.0-SNAPSHOT.pom
file:/Users/user/Library/Android/sdk/extras/google/m2repository/org/apache/commons/commons-imaging/1.0-SNAPSHOT/commons-imaging-1.0-SNAPSHOT.jar
Console log (requesting org.apache.commons:commons-imaging:1.0-SNAPSHOT):
$ react-native run-android
JS server already running.
Building and installing the app on the device (cd android && ./gradlew installDebug)...
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugCompile'.
> Could not find org.apache.commons:commons-imaging:1.0-SNAPSHOT.
Searched in the following locations:
https://jcenter.bintray.com/org/apache/commons/commons-imaging/1.0-SNAPSHOT/maven-metadata.xml
https://jcenter.bintray.com/org/apache/commons/commons-imaging/1.0-SNAPSHOT/commons-imaging-1.0-SNAPSHOT.pom
https://jcenter.bintray.com/org/apache/commons/commons-imaging/1.0-SNAPSHOT/commons-imaging-1.0-SNAPSHOT.jar
file:/Users/user/Library/Android/sdk/extras/android/m2repository/org/apache/commons/commons-imaging/1.0-SNAPSHOT/maven-metadata.xml
file:/Users/user/Library/Android/sdk/extras/android/m2repository/org/apache/commons/commons-imaging/1.0-SNAPSHOT/commons-imaging-1.0-SNAPSHOT.pom
file:/Users/user/Library/Android/sdk/extras/android/m2repository/org/apache/commons/commons-imaging/1.0-SNAPSHOT/commons-imaging-1.0-SNAPSHOT.jar
file:/Users/user/Library/Android/sdk/extras/google/m2repository/org/apache/commons/commons-imaging/1.0-SNAPSHOT/maven-metadata.xml
file:/Users/user/Library/Android/sdk/extras/google/m2repository/org/apache/commons/commons-imaging/1.0-SNAPSHOT/commons-imaging-1.0-SNAPSHOT.pom
file:/Users/user/Library/Android/sdk/extras/google/m2repository/org/apache/commons/commons-imaging/1.0-SNAPSHOT/commons-imaging-1.0-SNAPSHOT.jar
Required by:
ReactNativeProject:app:unspecified > ReactNativeProject:react-native-image-store-ext:unspecified
Console log (requesting org.apache.commons:commons-imaging:+):
$ react-native run-android
JS server already running.
Building and installing the app on the device (cd android && ./gradlew installDebug)...
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugCompile'.
> Could not find any matches for org.apache.commons:commons-imaging:+ as no versions of org.apache.commons:commons-imaging are available.
Required by:
ReactNativeProject:app:unspecified > ReactNativeProject:react-native-image-store-ext:unspecified
build.gradle:
buildscript {
repositories { jcenter() }
dependencies { classpath 'com.android.tools.build:gradle:2.1.0' }
}
apply plugin: 'com.android.library'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
lintOptions { abortOnError false }
}
repositories {
mavenCentral()
maven { url "http://jump-pilot.sourceforge.net/repository" }
maven { url "https://repo.adobe.com/nexus/content/repositories/public/" }
maven { url "https://repository.apache.org/content/repositories/snapshots/" }
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
compile "com.facebook.react:react-native:+"
compile 'org.apache.commons:commons-imaging:+'
}

There are 2 build.gradle file in android project: the one inside main project folder and the one inside app folder. The repository should be defined under allprojects block inside project folder. Here, example of my build.gradle which successful build apache commons imaging.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven { url "http://jump-pilot.sourceforge.net/repository" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

Apparently, there is no oficial version for apache commons imaging yet.
The latest unoficial version I have found, is on this repo
maven { url "http://wcm.io/maven/repositories/apache-intermediate-release/" }
Add this line on the build.gradle as opris said.
Then, in your gradle app/module file, add this
dependencies {
...
implementation 'org.apache.commons:commons-imaging:1.0-R1725432'
...
}
I haven't tested it yet, so I will have to choose between this one and the oficial version of sanselan,
compile 'org.apache.sanselan:sanselan:0.97-incubator'
which has no more support

Related

Android resource linking failed - AAPT: error: resource android:attr/dialogCornerRadius not found

I am receiving errors when trying to bundle an android release for a react-native project. This project should be converted to AndroidX as a note.
Error Messages
When trying to build a release build for Android I receive the following errors:
* What went wrong:
Execution failed for task ':react-native-vector-icons:verifyReleaseResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> 1 exception was raised by workers:
com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed
/Users/.../.gradle/caches/transforms-2/files-2.1/5c74eb36d229b35abeeb690f5d3b91a3/appcompat-1.0.0/res/values-v28/values-v28.xml:5:5-8:13: AAPT: error: resource android:attr/dialogCornerRadius not found.
/Users/.../.gradle/caches/transforms-2/files-2.1/5c74eb36d229b35abeeb690f5d3b91a3/appcompat-1.0.0/res/values-v28/values-v28.xml:9:5-12:13: AAPT: error: resource android:attr/dialogCornerRadius not found.
/Users/.../.gradle/caches/transforms-2/files-2.1/f54ae08833e39bf2b75fd420ffea65b9/core-1.0.0/res/values/values.xml:57:5-88:25: AAPT: error: resource android:attr/fontVariationSettings not found.
/Users/.../.gradle/caches/transforms-2/files-2.1/f54ae08833e39bf2b75fd420ffea65b9/core-1.0.0/res/values/values.xml:57:5-88:25: AAPT: error: resource android:attr/ttcIndex not found.
Root Build.gradle file
buildscript {
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 28
supportLibVersion = "28.0.0-alpha1"
reactNativeVersion = "0.59.9"
}
repositories {
jcenter()
google()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
dependencies {
classpath('com.android.tools.build:gradle:3.6.3')
classpath 'com.google.gms:google-services:4.2.0'
// Add the Crashlytics Gradle plugin.
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.1.1'
}
}
allprojects {
repositories {
google()
mavenLocal()
maven {
url 'https://maven.google.com/'
name 'Google'
}
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
// React native video - exoplayer missing from google repos, temp fix
maven {
url "https://google.bintray.com/exoplayer/"
}
jcenter()
}
}
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 28
supportLibVersion = "28.0.0-alpha1"
reactNativeVersion = "0.59.9"
}
subprojects {
afterEvaluate {project ->
if (project.hasProperty("android")) {
android {
compileSdkVersion compileSdkVersion
buildToolsVersion "$buildToolsVersion"
}
}
}
}
App build.gradle file
dependencies
dependencies {
implementation project(':react-native-safe-area-context')
implementation 'com.android.support:support-annotations:28.0.3'
implementation "androidx.annotation:annotation:1.1.0"
implementation project(':react-native-video')
implementation(project(":react-native-google-signin"))
implementation project(':react-native-splash-screen')
implementation project(':react-native-iap')
implementation project(':react-native-version-check')
implementation project(':react-native-vector-icons')
implementation project(':react-native-linear-gradient')
implementation(project(':react-native-firebase')) {
transitive = false
}
implementation project(':react-native-fbsdk')
implementation project(':react-native-linear-gradient')
implementation project(':react-native-vector-icons')
implementation project(':react-native-fbsdk')
implementation project(':react-native-vector-icons')
// react-native-google-signin
// react-native-fbsdk
implementation 'com.facebook.android:facebook-android-sdk:4.33.0'
implementation project(':react-native-fbsdk')
// RNFirebase required dependencies
implementation "com.google.firebase:firebase-core:16.0.9"
implementation "com.google.android.gms:play-services-base:17.0.0"
// RNFirebase optional dependencies
implementation "com.google.firebase:firebase-auth:17.0.0"
implementation "com.google.firebase:firebase-database:16.0.5"
implementation "com.google.firebase:firebase-firestore:17.1.4"
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation ("com.facebook.react:react-native:0.59.9") {force = true} // From node_modules
implementation 'com.google.firebase:firebase-crashlytics:17.0.1'
}
Research
I have seen some other issues of this being reported such as:
React-native(android) AAPT: error: resource android:attr/dialogCornerRadius not found
https://fincoapps.com/error-resource-androidattr-dialogcornerradius-not-found/.
However, these look to be setup as you'd expect. One issue suggests the subprojects edit that exists in the root build.gradle file, but the same error messages always occur.
Edit
gradle-wrapper.properties
#Thu May 07 14:26:41 BST 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
android.enableJetifier=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
android.useAndroidX=true
React-native info
npmPackages:
react: ^16.7.0 => 16.13.1
react-native: 0.59.9 => 0.59.9
npmGlobalPackages:
react-native-cli: 2.0.1
Solution 1:
Check what all react native projects are supporting androidX now.
gradlew app:dependencies
Search for androidX in the output. Get all the libraries having androidx.
Make a change in build.gradle inside android/app
configurations.all {
resolutionStrategy {
force 'com.google.android.gms:play-services-gcm:16.1.0'
force 'com.google.android.gms:play-services-basement:16.2.0'
force 'com.google.android.gms:play-services-auth:16.0.1'
force 'com.google.firebase:firebase-messaging:18.0.0'
force 'com.google.firebase:firebase-common:17.0.0'
force 'com.google.firebase:firebase-iid:18.0.0'
force 'com.google.android.gms:play-services-stats:16.0.1'
force 'com.google.android.gms:play-services-base:16.0.1'
}
}
These were the libraries that caused problem in my react native project.
Google maintains all the releases here https://developers.google.com/android/guides/releases#may_07_2019 . You can choose any other version also. This solution solved issue in my case. Let me know if this helps.
Solution 2
rm -rf android/.gradle
rm -rf .gradle
rm -rf ~/.gradle
./gradlew clean

AndroidX. Could not determine artifacts for androidx.multidex:multidex:2.0.0

I try to migrate a project to AndroidX.
After 3 minutes of migrating it finished with error:
Gradle import
errorsC:\Users\user\AndroidStudioProjects\project\app\build.gradleproject
':app': Unable to build Kotlin project configurationDetails:
org.gradle.api.artifacts.ResolveException: Could not resolve all
dependencies for configuration
':app:implementationDependenciesMetadata'.Caused by:
org.gradle.internal.resolve.ArtifactResolveException: Could not
determine artifacts for androidx.room:room-runtime:2.0.0Caused
by: org.gradle.api.resources.ResourceException: Could not get resource
'https://dl.google.com/dl/android/maven2/androidx/room/room-runtime/2.0.0/room-runtime-2.0.0.aar'.Caused
by: org.gradle.internal.resource.transport.http.HttpRequestException:
Could not HEAD
'https://dl.google.com/dl/android/maven2/androidx/room/room-runtime/2.0.0/room-runtime-2.0.0.aar'.Caused
by: javax.net.ssl.SSLHandshakeException: Remote host closed connection
during handshakeCaused by: java.io.EOFException: SSL peer shut
down incorrectly
FAILURE: Build failed with an exception.
What went wrong:
Could not resolve all dependencies for configuration ':app:debugRuntimeClasspath'.
Could not determine
artifacts for androidx.multidex:multidex:2.0.0
Could not get resource 'https://dl.google.com/dl/android/maven2/androidx/multidex/multidex/2.0.0/multidex-2.0.0.aar'.
Could not HEAD 'https://dl.google.com/dl/android/maven2/androidx/multidex/multidex/2.0.0/multidex-2.0.0.aar'.
Remote host closed connection during handshake SSL peer shut down incorrectly
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
How to solve a problem with multidex and Maven?
build.gradle (project):
buildscript {
ext.compile_sdk_version = 29
ext.min_sdk_version = 16
ext.target_sdk_version = 29
ext.kotlin_version = '1.3.40'
ext.supportLibraryVersion = "28.0.0"
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// Firebase.
classpath 'com.google.gms:google-services:4.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.gradle (app):
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
android {
signingConfigs {
...
}
compileSdkVersion compile_sdk_version
defaultConfig {
minSdkVersion min_sdk_version
targetSdkVersion target_sdk_version
vectorDrawables.useSupportLibrary = true
}
buildTypes {
debug {
applicationIdSuffix '.debug'
debuggable true
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
multiDexEnabled true
}
release {
debuggable false
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
// Adds the "release" signing configuration to the release build type.
signingConfig signingConfigs.release
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
...
implementation 'androidx.multidex:multidex:2.0.0'
}
UPDATE
I updated all libraries in dependencies. Then in project's build.gradle I added
maven { url "https://jitpack.io" }
maven { url "https://maven.google.com" }
to repositories in both branches. After compilation I got:
What went wrong: Could not determine the dependencies of task ':app:kaptDebugKotlin'.
Could not resolve all task dependencies for configuration ':app:kapt'.
Could not resolve androidx.room:room-compiler:2.1.0.
Required by:
project :app
Could not resolve androidx.room:room-compiler:2.1.0.
Could not get resource 'https://dl.google.com/dl/android/maven2/androidx/room/room-compiler/2.1.0/room-compiler-2.1.0.pom'.
Could not GET 'https://dl.google.com/dl/android/maven2/androidx/room/room-compiler/2.1.0/room-compiler-2.1.0.pom'.
Remote host closed connection during handshake
Could not resolve androidx.room:room-compiler:2.1.0.
Could not get resource 'https://maven.google.com/androidx/room/room-compiler/2.1.0/room-compiler-2.1.0.pom'.
Could not GET 'https://dl.google.com/dl/android/maven2/androidx/room/room-compiler/2.1.0/room-compiler-2.1.0.pom'.
Remote host closed connection during handshake
I added in build.gradle (project) these lines:
maven { url "https://jitpack.io" }
maven { url "https://maven.google.com" }
So, it looks like:
buildscript {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
maven { url "https://maven.google.com" }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.40"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
maven { url "https://maven.google.com" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Then synced gradle file. It downloaded some libraries from Maven. After compiling I got another error. Then I pressed Sync Project with Gradle files again.
See also https://developer.android.com/jetpack/androidx/migrate to understand what library and styles becomes what in AndroidX.
Strange, but after compiling and removing
maven { url "https://jitpack.io" }
maven { url "https://maven.google.com" }
back from build.gradle, the application run again.

Trying to add timber to Kotlin project results in multiple 'Unable to resolve dependency for...' Gradle errors

I have added implementation 'com.jakewharton.timber:timber:4.7.1' to my Kotlin project and now I get the following Gradle errors:
Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
Unable to resolve dependency for ':app#debug/compileClasspath': Could not resolve com.jakewharton.timber:timber:4.7.1.
Open File
Show Details
Unable to resolve dependency for ':app#debugAndroidTest/compileClasspath': Could not resolve com.jakewharton.timber:timber:4.7.1.
Open File
Show Details
Unable to resolve dependency for ':app#debugUnitTest/compileClasspath': Could not resolve com.jakewharton.timber:timber:4.7.1.
Open File
Show Details
Unable to resolve dependency for ':app#release/compileClasspath': Could not resolve com.jakewharton.timber:timber:4.7.1.
Open File
Show Details
Unable to resolve dependency for ':app#releaseUnitTest/compileClasspath': Could not resolve com.jakewharton.timber:timber:4.7.1.
Open File
Show Details
Strangely though I can see it downloading as Gradle syncs:
I also tried adding timberkt but got a similar error.
My whole app/build.gradle file looks like this:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlinx-serialization'
android {
compileSdkVersion 26
defaultConfig {
applicationId "uk.co.davechambers.pegboard"
targetSdkVersion 26
minSdkVersion 21
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary= true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
google()
jcenter()
maven { url "https://kotlin.bintray.com/kotlinx" }
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation"org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:26.0.0-beta2'
testImplementation 'junit:junit:4.12'
implementation 'com.android.support:design:26.0.0-beta2'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:support-vector-drawable:26.0.0-beta2'
implementation 'com.jakewharton.timber:timber:4.7.1'
compile "org.jetbrains.anko:anko:$anko_version"
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compile "org.jetbrains.kotlinx:kotlinx-serialization-runtime:$serialization_version"
}
kotlin {
experimental {
coroutines "enable"
}
}
androidExtensions {
experimental = true
}
Clearly I'm doing something wrong. Can anybody point me in the right direction?
I added an additional Maven url to build.gradle (Module: app):
repositories {
google()
jcenter()
maven { url "https://kotlin.bintray.com/kotlinx" }
maven { url "http://jcenter.bintray.com"}
}
and to build.gradle (Project: projectName):
buildscript {
ext.kotlin_version = '1.2.40'
ext.anko_version = '0.10.5'
ext.serialization_version = '0.4.1'
repositories {
google()
jcenter()
maven { url "https://kotlin.bintray.com/kotlinx" }
maven { url "http://jcenter.bintray.com"}
}
.....
After that, everything worked.

gradle Could not resolve all dependencies for configuration ':compile'

I have a dependencies problem I need help with.
I can build EGLSource fin on its own.
But when i try to build EGL2JS then I get this error:
Error message:
:compileJava
FAILURE: Build failed with an exception.
* What went wrong:
Could not resolve all dependencies for configuration ':compile'.
> Could not find :swt-64:.
Searched in the following locations:
https://repo1.maven.org/maven2//swt-64//swt-64-.pom
https://repo1.maven.org/maven2//swt-64//swt-64-.jar
Required by:
:EGL2JS:unspecified > EGL2JS:EGLSource:unspecified
Build and settings files for the two projects: EGLSource and EGL2JS.
EGL2JS: settings.gradle
include ':EGLSource'
project(':EGLSource').projectDir = new File(settingsDir, '../EGLSource')
EGL2JS: build.gradle
apply plugin: 'java'
repositories {
mavenCentral()
}
dependencies {
compile project(':EGLSource')
}
sourceSets {
main {
java.srcDirs = ['src', 'target/generated-sources']
}
}
EGLSource: build.gradle
apply plugin: 'java'
repositories {
flatDir {
dirs 'lib'
}
}
dependencies {
compile name: 'swt-64'
}
sourceSets {
main {
java.srcDirs = ['src', 'target/generated-sources/antlr4']
}
}
Why is EGL2JS complaining about a dependency in EGLSource?
I could add the swt-64.jar to EGL2JS. But EGL2JS does not directly depend on swt-64.jar so I don't like that solution.
Are there other ways to resolve this dependency?
For reasons I don't understand this makes a difference.
Removing flatFile from repositories
and changing dependencies
from:
compile name: 'swt-64'
to:
dependencies {
compile fileTree(dir: 'lib', include: 'swt-64.jar')
}
Also gradle dependencies not longer shows swt-64 failed.

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()
}
}

Resources