27 Oct 2013

ViewPagerIndicator AAR packaged

Many people, developing applications for Android, use ViewPagerIndicator library. It's nice and open-sourced (you can clone or fork sources at GitHub). But after Google introduced Gradle build system in Android Studio, that can resolve dependencies through maven central repository we all very lack of AAR packaged version of that library - it's published in maven central, but in other pakaging (jar, apklib, etc.), that can not be properly used by gradle. However, author of ViewPagerIndicator, Jake Wharton doesn't hurry to publish aar packaging. But our developer, Serge Populov already built and published ViewPagerIndicator AAR package for public use.

To add dependency to ViewPagerIndicator AAR:
repositories {
    maven { url "http://dl.bintray.com/populov/maven" }
    mavenCentral()
}
  • Use in your dependencies as usual:
dependencies {
    compile 'com.viewpagerindicator:library:2.4.1@aar'
}
Why priorior to mavenCentral?
Otherwise gradle will look first in mavenCentral, find viewpagerindicator artifact with the same version, but won't find aar package and will report an error, without looking for same artifact with another packaging in other repositories.

8 comments:

  1. disqus_D5EpY60qw212 November 2013 at 10:20

    I'd love to use this, but android studio gives me this:

    Gradle: A problem occurred configuring project ':FlashNotifier'.
    > Failed to notify project evaluation listener.
    > Could not download artifact 'com.viewpagerindicator:library:2.4.1@aar'
    > Artifact 'com.viewpagerindicator:library:2.4.1@aar' not found.

    ReplyDelete
  2. disqus_D5EpY60qw213 November 2013 at 05:06

    that worked! Thanks for your help, accidentally put the url in the wrong repositories block

    ReplyDelete
  3. Marcello Ribeiro20 April 2014 at 00:33

    hi Serge, sorry for disturbing!

    I am 10 years experienced Eclipse user, but now i am the newest Android Studio newbie of the world... I´ve never worked with gradle before and now i am fighting to import external libs in AS...
    The point is as i see you have published viewpagerindicator as AAR and i got no problem following your step above, gradle has runned successfully. But, my first way to test a lib is now really in the classpath is to try to Ctrl+Shift+T it and type a know class in the dialog. I am trying to find "com.viewpagerindicator.TitlePageIndicator" for example but AS does not find it at all.

    Any comment, helps, tips?

    Thank you for helping the community in these issues!

    Marcello Ribeiro

    ReplyDelete
  4. If I'm not mistaken, Ctrl+Shift+T is a shortcut for running tests (in default shortcuts layout)? It lists existing unit tests for current class, so, VPI classes won't be listed there. You should be able to use class VPI in autocompetes and navigating to class (Ctrl+N) after the first successfull build - does it work?

    ReplyDelete
  5. mobiledevstories16 January 2015 at 15:17

    Wonderful job my friend. I could import your version of VPI and make it work successfully. Will you maintain this repo for a long time?
    I guess the official VPI author will finish uploading a version to the official maven central, but... For the moment we all depend on you! :-)

    ReplyDelete
  6. The repository will be available as long as JFrog maintains existance of Bintray.

    ReplyDelete
  7. Sorry, I have some problem like picture.
    What steps do I have to miss?

    ReplyDelete