Can't add ViewPagerIndicator to app with Gradle
Asked Answered
K

1

14

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

Krysta answered 13/4, 2015 at 21:37 Comment(2)
possible duplicate of Using ViewPagerIndicator library with Android Studio and GradleOffen
@Offen it is not a duplicate. this issue occurs when you have wrong repositories order but everything else is as it should be to get ViewPagerIndicator AAR library import.Oni
G
25

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()

    }
}
Giovannigip answered 13/4, 2015 at 21:46 Comment(2)
It doesn't work for me. any ideas? I have it this wayReceipt
OMG!!! I was dealing with this for a whole day and I could not add VIewPagerINdicator (using gradle)!! trying other answers on the site. I was gonna give up. But your answer saved me. The difference is the order!! first and second line. That's all!! Thanks a lot :)Ebner

© 2022 - 2024 — McMap. All rights reserved.