0

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'

}
Community
  • 1
  • 1
jublikon
  • 3,427
  • 10
  • 44
  • 82

1 Answers1

2

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'

}
oiZo
  • 432
  • 3
  • 10
  • Which version should I use? Yes, I have read that in project gradle file it will be applied to everything and inside of module just to the specific module. But I keep misunderstanding that. When I add the dependency it is available in the whole project, right? So where will it be not accessable if I use to include the library in build.gradle module app file? – jublikon Jun 09 '16 at 09:44
  • Yes, if the repository is added to module:app (the second version), it will only be available there, and that is how it's preferred. Don't add dependencies to the project build.gradle unless it's needed. – oiZo Jun 09 '16 at 09:51