jublikon
jublikon

Reputation: 3447

Add specific repository to build file

Problem: I would like to include that library to my project. When I add the dependency I get:

Failed to resolve: com.github.glomadrian:loadingballs1.1

Question: How do I have to change my gradle file to solve the problem? I think it has something to do with adding the repository maven. If it is like that, where do I have to put it correctly?

Note: I have found a post that seems to answer my question but unfotunately I still get the issue.

The library gives a small tutorial:

Add the specific repository to your build file:

Their sample code:

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

I have added the maven repository to my build file like that:

build.gradle (Project)

   buildscript {
    repositories {
        jcenter()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.1.2'

        //Maven plugin
        classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'

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

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

}

task clean(type: Delete) {
    delete rootProject.buildDir
}

build.gradle (Module:app)

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"

    defaultConfig {
        applicationId "com.stack.overflow"
        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'])
    testCompile 'junit:junit:4.12'
    (...)
    compile 'com.github.glomadrian:loadingballs:1.1@aar'

}

Upvotes: 0

Views: 2680

Answers (1)

hw4m
hw4m

Reputation: 432

Yes, you'll need to add the repository to your gradle configuration, either in your project build.gradle like so:

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

or to the module:app build.gradle like so:

apply plugin: 'com.android.application'

android {
    (... your config...)
}

repositories {
    maven {
        url "http://dl.bintray.com/glomadrian/maven"
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    (... more dependencies ...)
    compile 'com.github.glomadrian:loadingballs:1.1@aar'

}

Upvotes: 2

Related Questions