Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't add ViewPagerIndicator to app with Gradle

i am trying to add Jack Whartons ViewPagerIndicator library https://github.com/JakeWharton/ViewPagerIndicator to my app as i want to use the circle indicator for the viewpager i have. However i am having trouble adding it to my app. i have followed this tutorial - Using ViewPagerIndicator library with Android Studio and Gradle

However i am getting this error

    Error:Artifact 'library.aar (com.viewpagerindicator:library:2.4.1)' not found.
Searched in the following locations:
    https://jcenter.bintray.com/com/viewpagerindicator/library/2.4.1/library-2.4.1.aar

if i remove the jCenter() code in my gradle then it works but the other dependencies i have included do not, so i am not sure how to get round having all the dependencies work together.

Here is my top level gradle file

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

buildscript {
    repositories {
        jcenter()
        maven { url "http://dl.bintray.com/populov/maven" }
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.0.1'

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

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

    }
}

And here is my module:app gradle file

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    buildToolsVersion "21.1.2"

    defaultConfig {
        applicationId "co.app.al.app"
        minSdkVersion 16
        targetSdkVersion 22
        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:22.0.0'
    compile 'com.afollestad:material-dialogs:0.6.2.3'
    compile files('libs/volley.jar')
    compile 'uk.co.chrisjenx:calligraphy:2.0.2'
    compile 'com.viewpagerindicator:library:2.4.1@aar'

}

Thanks for any and all help

like image 250
Al Hennessey Avatar asked Apr 13 '15 21:04

Al Hennessey


1 Answers

You can check the maven repository or jcenter:

http://search.maven.org/#search%7Cga%7C1%7Ccom.viewpagerindicator

https://bintray.com/bintray/jcenter/com.viewpagerindicator%3Alibrary/view#files

There is a library artifact with 2.4.1, but it ISN'T an AAR file.

You have to use an alternative repo maven { url "http://dl.bintray.com/populov/maven" }, but it is important the order.

Change your script:

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

    }
}
like image 183
Gabriele Mariotti Avatar answered Oct 14 '22 17:10

Gabriele Mariotti