Using ViewPagerIndicator library with Android Studio and Gradle

A bit late to the party, but here:

Jake Wharton hasn't released it in maven as an aar. There's a group though that has made an aar of it available through their server, you can set it up like this in your build.gradle:

Add this to your source repositories after you declare your plugins:

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

This will source their maven repo, which contains a packaged aar that they put together. Once that's done, you can simply add this line to your dependencies and everything should work once you sync your project with your gradle files.

Make sure that the Maven Repo is listed above the mavenCentral() entry. Otherwise, it will first look in maven's central repository and find the wrong package.

Android Studio generates two build.gradle files for projects, make sure you put this in the right one!

dependencies {
    // ...
    compile 'com.viewpagerindicator:library:2.4.1@aar'
    // ...
}

We use it in our app if you'd like to see a working example:

https://github.com/pandanomic/SUREwalk_android/blob/master/surewalk/build.gradle


I'm using gradle 0.10.+ with Android Studio 0.8.2 and the accepted answer didn't work for me. These are the slight changes I had to do in order to get ABS working in my project:

In the top level build.gradle file of your project add the maven repository in the allprojects config like this:

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

And in the module's build.gradle file add the dependency without the @aar:

dependencies {
   // ...
   compile 'com.viewpagerindicator:library:2.4.1'
   // ...
}

I just pushed a version inside maven central so you only need to add that dependency :

compile 'fr.avianey.com.viewpagerindicator:library:2.4.1.1@aar'

And declare maven central like this :

repositories {
    mavenCentral()
}

Hope it helps...