I have a project with just two dependencies, the relatively standard appcompat-v7
and ion
. So my gradle files are pretty straightforward:
Project
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
}
}
allprojects {
repositories {
jcenter()
}
}
App
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.0"
defaultConfig {
applicationId "zz.yy.xx"
minSdkVersion 18
targetSdkVersion 23
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:23.0.1'
compile 'com.koushikdutta.ion:ion:2.1.6'
}
In fact I think the only thing I added myself is the ion
dependency.
I'm not a gradle guru, but I have read in multiple places that jcenter is a so called superset of mavenCentral. Specifically this answer
JCenter itself is a thin veneer on top of Maven Central. It proxies it (more or less successfully) and adds additional components. Both are hosted on CDN networks and highly performant. Maven Central itself is the target for all Eclipse, Apache and most other open source projects and without it JCenter would be mostly empty.
and this one
You never need both. JCenter is a superset of Maven Central, and it should be suffice for all the dependencies.
I am with JFrog, the company behind Bintray and [artifactory], see my profile for details and links.
make me believe that they are essentially the same as far as providing software packages goes, only jcenter is better in some way. Especially the poster of the latter answer appears to know what he is talking about.
However, I cannot pull in the ion dependency with jcenter. I always get this error
To get it to work, I need to add mavenCentral as well. So the above gradle snippet doesn't work, but if I change allprojects
to this
allprojects {
repositories {
jcenter()
mavenCentral()
}
}
it magically starts working.
How is this possible? I have verified that both offer the package:
- http://search.maven.org/#artifactdetails%7Ccom.koushikdutta.ion%7Cion%7C2.1.6%7Cjar
- https://bintray.com/bintray/jcenter/com.koushikdutta.ion%3Aion/2.1.6/view
Gradle settings
I've tried the local wrapper with no success.
Android Studio 1.3.2
Gradle 1.3.0