jitpack.io failed to resolve github repo

AndroidGitGithubJitpack

Android Problem Overview


I have a Github repo and pushed tags on it.

This is my gradle file of my main project.

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.0"

    defaultConfig {
        applicationId "dropbox.ric.es.myapplication"
        minSdkVersion 16
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

repositories {
    //mavenCentral()
    //jcenter()

    maven { url "https://jitpack.io" }

}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:23.0.1'
    compile 'com.github.rchampa:DropboxHttpConector:1.0.1'
}

But when I sync gradle I have the following error Failed to resolve com.github.rchampa:DropboxHttpConector:1.0.1

Another attempt:

allprojects {
    repositories {
        jcenter()
        maven { url "https://jitpack.io" }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:23.0.1'
    compile 'com.github.rchampa:DropboxHttpConector:1.0.1'
}

Still failing.

Android Solutions


Solution 1 - Android

For anyone else that made the simple mistake I made:

Ensure you add the maven { url "https://jitpack.io" } under allprojects instead of buildscript.

Project build.gradle file:

buildscript {
    repositories {
        jcenter()
        // DO NOT ADD IT HERE!!!
    }
    ...
}

allprojects {
    repositories {
        mavenLocal()
        jcenter()
        // ADD IT HERE
        maven { url "https://jitpack.io" }
    }
}

Thanks to [Alexander Pacha][1] for pointing that out in a comment above.

[1]: https://stackoverflow.com/users/448357/alexander-pacha "Alexander Pacha"

Solution 2 - Android

After a few attempts and thanks to jitpack support now I can import my library hosted in Github as a Android Gradle dependency.

I will provide a a few very useful links:

How setup your java library

https://jitpack.io/docs/BUILDING/#gradle-projects

How check logs of your dependency in jitpack

https://jitpack.io/com/github/USER/REPO/TAG/build.log

In my case

https://jitpack.io/com/github/rchampa/DropboxHttpConector/1.0.3/build.log

Solution 3 - Android

Newer versions of Android Studio don't use allprojects anymore.

Open the file settings.gradle and add the repository as shown below:

dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
        maven { url 'https://jitpack.io' } // <- here we go
        jcenter()
    }
}

Also remove the code below from the file project's build.gradle, if it is still there:

allprojects {
repositories {
    jcenter()
    maven { url "https://jitpack.io" }
}}

Solution 4 - Android

I have several dependencies from Jitpack and I encountered this issue after migrating to Gradle 2.

The solution in my case was to change the version in distributionUrl in gradle-wrapper.properties from 2.10 (which was automatically set by Studio when I accepted updating the wrapper version) to the latest one.

Solution 5 - Android

Hallelujah I got the problem!

So I realised that PROBLEM is relied on my NETWORK! I can't acces https://jitpack.io/ from my IP that's why nothing was working. Just shared internet from a GSM module(to get a different IP) and problem is gone using @SteveMellross solution

Maybe it can be 0.001% that you have the same problem but if nothing works just try to access https://jitpack.io/ ;)

I hope there is just a firewall or internal router error and my IP is not banned by their service.

Solution 6 - Android

Verify that maven { url "https://jitpack.io" } is in allprojects section in build.gradle (Project)

Solution 7 - Android

For me I did this

1.Forked the original unmaintained repo

2.Did some changes,created the commit

3.Copied commit hash from commit details page url eg https://github.com/omkar-tenkale/NavigationTabStrip/commit/9d097af9fe2167fc0dfc71d2e63d6194b2cebfb0

4.Created implementation string from repo url

> implementation 'com.github.User:Repo:Version'

    Group: com.github.Username
    Artifact: Repository Name
    Version: Release tag, commit hash or master-SNAPSHOT
    More at https://github.com/jitpack/jitpack.io

I used commit hash as Version

> implementation > 'com.github.omkar-tenkale:NavigationTabStrip:9d097af9fe2167fc0dfc71d2e63d6194b2cebfb0'

5.Now added that in android app module's build gradle

6.But got error Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve...etc

7.Created a link in below format

> https://jitpack.io/com/github/USER/REPO/TAG/build.log

In my case https://jitpack.io/com/github/omkar-tenkale/NavigationTabStrip/9d097af9fe2167fc0dfc71d2e63d6194b2cebfb0/

8.Opened this link in browser

9.Saw something like this

NavigationTabStrip-9d097af9fe2167fc0dfc71d2e63d6194b2cebfb0-javadoc.jar
NavigationTabStrip-9d097af9fe2167fc0dfc71d2e63d6194b2cebfb0-sources.jar
NavigationTabStrip-9d097af9fe2167fc0dfc71d2e63d6194b2cebfb0.aar
NavigationTabStrip-9d097af9fe2167fc0dfc71d2e63d6194b2cebfb0.pom
NavigationTabStrip-9d097af9fe2167fc0dfc71d2e63d6194b2cebfb0.pom.md5
NavigationTabStrip-9d097af9fe2167fc0dfc71d2e63d6194b2cebfb0.pom.sha1
build.log

10. In studio synced gradle again It worked!

This is far better then downloading repo,importing as module in our app and then using it etc etc.

Whenever you make changes to this forked repo don't forget to update commit hash too!

Solution 8 - Android

I meet this problem when I try to import orhanobut/logger from github. Then I go to jitpack.io and search for the package: find logger in jitpack Then I clicked the log icon,and found:

Start: Thu Jan 14 11:56:56 UTC 2016 Git:v1.9 commit 5abbc1563422457d4c23e1a0a412d2b0c7dc334e Merge: 8ef1e6b 522d44d Author: Orhan Obut Date: Mon May 25 11:34:20 2015 +0200

Merge pull request #30 from orhanobut/oo/settings-fix submodule status: Run gradle build Gradle build script Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 Downloading https://services.gradle.org/distributions/gradle-2.2.1- all.zip

So this is it,it use gradle 2.2.1-all!

Then I go to my project and change gradle version to 2.2.1 in settings.gradle, everything worked fine!

Solution 9 - Android

I'm using Android Studio Arctic Fox 2020.3.1 | Canary 8 and had the issue above. My repo project is a pure Kotlin project that I want to import into my Android project.

Here are a few steps I did that fixed the issue for me - it could be one of the steps or a combination of them that fixed the issue.

  1. The tag I initially pushed was v0.0.1 but in my build.gradle for the Kotlin project it was version '0.0.1' without the v. So I renamed the tag to 0.0.1 and pushed the tag. @Ricardo's answer above about how to check the JitPack build log was super useful!
  2. Next I ran ./gradlew install on my local machine in the Kotlin repo. This is one of the commands run by JitPack - see the JitPack documentation. When I did this I found this message: Declare the version of Java your build requires.
  3. From that message I decided to specify the Java version. In the Kotlin project build.gradle I added sourceCompatibility = 1.8 and
    compileKotlin {
    kotlinOptions {
    jvmTarget = "1.8"
    }
    }
  4. After re-running the command in step 2, the Java version issue disappeared.
  5. I pushed the new version of my Kotlin repo and added a new tag.
  6. In the Android project, I had to add the maven { url "https://jitpack.io" } in settings.gradle. I encountered errors when adding it in the build.gradle files for the app or the root one.

Solution 10 - Android

I know this is old but I had this problem recently and I solved it by adding

maven { url 'https://jitpack.io' }

to the settings.gradle(ProjectSettings) under dependencyResolutionManagement{repositories{$HERE}}. I don't know if it is recommended or just a fluke since I am not that well versed yet.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionRicardoView Question on Stackoverflow
Solution 1 - AndroidSteveMellrossView Answer on Stackoverflow
Solution 2 - AndroidRicardoView Answer on Stackoverflow
Solution 3 - AndroidNikhil SoniView Answer on Stackoverflow
Solution 4 - AndroidSqueezyMoView Answer on Stackoverflow
Solution 5 - AndroidCholetskiView Answer on Stackoverflow
Solution 6 - AndroidBacar PereiraView Answer on Stackoverflow
Solution 7 - AndroidOmkar TView Answer on Stackoverflow
Solution 8 - AndroidCastleView Answer on Stackoverflow
Solution 9 - AndroidATutorMeView Answer on Stackoverflow
Solution 10 - AndroidmaestroView Answer on Stackoverflow