1

I can't import any library using jitpack. My problem is with my own library, but below com.github.jitpack:android-example:1.0.4 is used as an example library provided by jitpack itself that should have worked out of the box. Also note that offline stuff are off in android studio.

Root build.gradle

buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.2'
    }
}
allprojects {
    repositories {
        google()
        jcenter()
        mavenCentral()
        maven { 
            name "jitpack"
            url "https://jitpack.io" 
        }
    }
}
task clean(type: Delete) {
    delete rootProject.buildDir
}

App build.gradle

apply plugin: 'com.android.application'
android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.me.stuff"
        minSdkVersion 26
        targetSdkVersion 28
        versionCode 1
        versionName "1.4"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    configurations.all {
        resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    productFlavors {
    }
}
dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'androidx.appcompat:appcompat:1.0.0'
    // etc...
    implementation 'com.github.jitpack:android-example:1.0.4'
}
configurations.all {
    resolutionStrategy {
        //force 'com.android.support:support-annotations:27.1.1'
    }
}

Error messages

Android studio shows:

ERROR: Failed to resolve: com.github.jitpack:android-example:1.0.4
Show in Project Structure dialog
Affected Modules: app

Running gradle from the command line shows:

Could not resolve all files for configuration ':app:debugCompileClasspath'.
> Could not find com.github.jitpack:android-example:1.0.4.
  Searched in the following locations:
      // A LOT OF IRRELEVANT LOCAL LOCATIONS OMITTED
      https://dl.google.com/dl/android/maven2/com/github/jitpack/android-example/1.0.4/android-example-1.0.4.pom
      https://dl.google.com/dl/android/maven2/com/github/jitpack/android-example/1.0.4/android-example-1.0.4.jar
      https://jcenter.bintray.com/com/github/jitpack/android-example/1.0.4/android-example-1.0.4.pom
      https://jcenter.bintray.com/com/github/jitpack/android-example/1.0.4/android-example-1.0.4.jar
      https://repo.maven.apache.org/maven2/com/github/jitpack/android-example/1.0.4/android-example-1.0.4.pom
      https://repo.maven.apache.org/maven2/com/github/jitpack/android-example/1.0.4/android-example-1.0.4.jar
      https://jitpack.io/com/github/jitpack/android-example/1.0.4/android-example-1.0.4.pom
      https://jitpack.io/com/github/jitpack/android-example/1.0.4/android-example-1.0.4.jar
  • can you try jitpack library with version 2.0 ? – Rahul Sep 23 '19 at 12:22
  • `https://jitpack.io/com/github/jitpack/android-example/2.0/android-example-2.0.pom` is working means 2.0 version is there on jitpack – Rahul Sep 23 '19 at 12:23
  • Also add the same jitpack maven url to buildScript block of your parent gradle file. – Jeel Vankhede Sep 23 '19 at 12:24
  • @RahulKumar It worked with 2.0! So that means the problem is with my library. Can you take a look at it: [github link](https://github.com/dboun/sticky-headers-recyclerview-androidx). – dimitris_2315 Sep 23 '19 at 12:25
  • @RahulKumar I try to import it using: ```implementation 'com.github.dboun.sticky-headers-recyclerview-androidx:library:0.5.0'``` – dimitris_2315 Sep 23 '19 at 12:26
  • if you go to https://jitpack.io/#dboun/sticky-headers-recyclerview-androidx/0.5.0, you will find that you need to use `implementation 'com.github.dboun:sticky-headers-recyclerview-androidx:0.5.0'` (library: is not needed) – Rahul Sep 23 '19 at 12:52

1 Answers1

0

If you have a look at https://jitpack.io/#jitpack/android-example or https://jitpack.io/com/github/jitpack/android-example/1.0.4/android-example-1.0.4.pom directly, you'll find that:

Build failed. See the log at jitpack.io

Therefore the artifact is not available for download. More details you'll find in the build.log at https://jitpack.io/com/github/jitpack/android-example/1.0.4/build.log.

Use version 1.0.3 or 2.0 to continue with your experiments. For your own artifacts you'll find the issue when you look at your own build.log and if you cannot figure out what's wrong, you could as well open an issue on https://github.com/jitpack/jitpack.io/issues.

tynn
  • 38,113
  • 8
  • 108
  • 143