jitpack.io dependencies are not working
Asked Answered
R

1

6

I cannot get jitpack.io dependencies to work with gradle. I know there are other questions but none of the suggested tips helped. The problem is, jitpack.io dependencies are not working at all. In theory it should be simple... add the mavel { url ... } and the compile declarative. But i keep getting an error that the dependency cannot be resolved.

I updated android-studio, which suggested to update and then updated gradle. Since every jitpack.io dependency is not working, it must be related to the configuration of gradle overall. Unfortunately i have no clou where to start.

I tried different repositories, so that should not be the problem. I also checked the corresponding build logs.

Can anybody help me?

This are my whole gradle files, they should be fine.

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
        mavenCentral()
        maven { url "http://jitpack.io" }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.2'
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

and

apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.0"

    defaultConfig {
        applicationId "patrickstummer.com.bonario_internal"
        minSdkVersion 19
        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:24.0.0-alpha2'
    compile 'com.jakewharton:butterknife:8.4.0'
    apt 'com.jakewharton:butterknife-compiler:8.4.0'
    compile 'com.github.soroushjavdan:ApplicationLocker:62301ce0b4'
}
Rajab answered 8/11, 2016 at 17:15 Comment(0)
S
4

Add it in your root build.gradle at the end of repositories:

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

Add the dependency

dependencies {
    compile 'com.github.User:Repo:Tag'
}
Slippery answered 8/11, 2016 at 17:26 Comment(3)
What if there's no tag?Glacier
@NickM you can use 'com.github.User:Repo:master-SNAPSHOT' or any needed branch nameClerical
I am not sure why this has to go at the end of the list of the repositories but it does. If you put mavenCentral after it, it does not work if something is not in jitpak.io and is in mavenCentral. Could it because it does return a page in the case of failure to find a dependency.Ichang

© 2022 - 2024 — McMap. All rights reserved.