7

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

enter image description here

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:

Gradle settings

enter image description here

I've tried the local wrapper with no success.

Android Studio 1.3.2
Gradle 1.3.0

Community
  • 1
  • 1
Tim
  • 41,901
  • 18
  • 127
  • 145
  • does the build itself fails after you do a sync? – user2511882 Sep 24 '15 at 18:39
  • @user2511882 It's actually the sync that fails - see edit – Tim Sep 24 '15 at 18:40
  • Yes, thats what i was asking for.. anyways, i am able to get that "ion" dependency in...however, it works only if i switch the classpath to 1.1.0.. fails here as well for 1.3.0, which is rather interesting. – user2511882 Sep 24 '15 at 18:42
  • The file is for sure downloadable from JCenter - https://bintray.com/artifact/download/bintray/jcenter/com/koushikdutta/ion/ion/2.1.6/ion-2.1.6.jar, so Gradle should be able to fetch it. Can it be possible that Bintray is blocked by your proxy or firewall? – JBaruch Sep 24 '15 at 18:53
  • @JBaruch how would I check that? I have no websites blocked in my router settings, I don't use a proxy and I can access the bintray site and ion just fine in the browser – Tim Sep 24 '15 at 19:01
  • That's weird... I tried to fetch it from an Android project and the Gradle sync worked all right. And I am using the 1.3.0 plugin version – Stephen Vinouze Sep 24 '15 at 19:05
  • Can you please try and add `:jar` in the end of the dependency declaration? – JBaruch Sep 24 '15 at 19:07
  • @JBaruch Tried `compile 'com.koushikdutta.ion:ion:2.1.6:jar'`, got the same error – Tim Sep 24 '15 at 19:09
  • Could you try compile 'com.koushikdutta.ion:ion:2.1.6@jar'? – Stephen Vinouze Sep 24 '15 at 19:13
  • @ptitvinou same error still – Tim Sep 24 '15 at 19:19
  • @JBaruch I am thinking it is network related, because at my girlfrields house it works. I will do some testing when I get home tomorrow – Tim Sep 27 '15 at 14:26
  • I was going to do tests, but forgot about it because I wasn't prompted by the error. Somehow it solved itself. Perhaps temporary connectivity issues..? – Tim Oct 01 '15 at 21:03

0 Answers0