Gradle fails to resolve dependencies from bintray

1.6k views Asked by At

I have uploaded library to bintray, but when I try to use it in my project gradle build fails with Error:(26, 13) Failed to resolve: com.ymirski.library:date-utils:0.0.1

Here is my app build.gradle dependencies:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:25.1.0'
    testCompile 'junit:junit:4.12'
    compile 'com.ymirski.library:date-utils:0.0.1'
}

project build.gradle:

allprojects {
    repositories {
        jcenter()
        maven {
            url  "http://droidlab.bintray.com/maven"
        }
    }
}

all data I've got from bintray: enter image description here

enter image description here

2

There are 2 answers

0
Vampire On

I think you didn't publish your library correctly. If you specify the dependency in Gradle like you did, it expects to find a JAR file, not an AAR file. If Gradle supports depending on AAR files (I don't do Android development), you probably have to explicitly state that you want the AAR by using compile 'com.ymirski.library:date-utils:0.0.1@aar'. But even with that, it does not work, which makes me think that you didn't do the publishing on Bintray correctly. But as I'm also not familiar with Bintray, I cannot tell you what is wrong exactly.

0
Ashwin On

The URL that worked for me is:

allprojects {
    repositories {
        ...
        maven {
            url  "https://dl.bintray.com/your-bintray-username/maven"
        }
    }
}

Add this in your project-level build.gradle file. Also replace 'your-bintray-username' with your Bintray username in the URL.

Now in your app-level build.gradle compile your library as:

dependencies {
    ...
    implementation 'your.group.id:your.artifact.id:version'
}

Hope this helps.