Add Viewpagerindicator to Android Studio

Add ViewPagerIndicator to Android Studio

UPDATE

Based on the answer given by Jürgen 'Kashban' Wahlmann, it is now possible to add ViewPagerIndicator via gradle:

Top Level Build.gradle:

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

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

App's build.gradle:

compile 'com.viewpagerindicator:library:2.4.1@aar'

Also, based on the answer given by Enrico Susatyo now it seems possible to download the library from Jitpack maven repositories. Do it as follows:

In root build.grade:

allprojects {
repositories {
...
maven { url "https://jitpack.io" }
}
}

In project build.grade:

dependencies {
compile 'com.github.JakeWharton:ViewPagerIndicator:2.4.1'
}

------------

To use Android-ViewPagerIndicator in Android Studio, you can’t download it from gradle. Instead, you must import the library as an “Existing Project” to your current one.

Follow these steps:

#1 Download source code from GitHub.

#2 In your Android Studio Project:
File -> Project Structure -> add (+ symbol) -> Import Existing Project. Import just the folder called ”library”, not the entire project (leave the import options as Android Studio suggests).

# 3 If the "compileSdkVersion" specified in your build.gradle doesn’t match with the one specified in the Android-ViewPagerIndicator project, change the second one. The same apply with any other property, such as "minSdkVersion" or even the current support library.

# 4 Add Android-ViewPagerIndicator project as a dependency to your build.gradle module:

dependencies {
compile project(':library')
}

# 5 Sync project with gradle files.

How add ViewPagerIndicator to android studio

Did you add library in Android Studio by File -> Project structure... -> Libriaries (or Modules)?

Gradle - Cannot import viewpagerindicator in Android Studio using gradle dependency

You can't import ViewPagerIndicator via

compile 'com.viewpagerindicator:library:2.4.0'

because that Maven artifact is just a jar of the Java library, but VPI relies on Android resources that aren't in the jar.

Maven artifacts that have AAR packaging do have resources and will work, but VPI isn't packaged that way. It has apklib packaging, but the Android Gradle plugin doesn't support that.

You'll need to download the source and set it up as an android-library module.

You weren't specific about what version of Android Studio you're running, but I'm willing to bet that your problem with the import not working is due to the fact that you're running something earlier than 0.4.3; bugs have been fixed in that area since then.

ViewPagerIndicator dependency with Gradle and Android Studio

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.

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

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

Using ViewPagerIndicator library with Android Studio and Gradle

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

Add ViewPagerIndicator Library Project to my Project in Android Studio

I went to File > Project Structure > Modules > clicked + sign > Import modules, then chose the project. I had to delete the sample part and keep only the library part. I also had to remove a android support jar, and then when I had compile errors, I had to do whatever android studio told me was a solution with the red light bulb.

Can't add ViewPagerIndicator to app with Gradle

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

}
}


Related Topics



Leave a reply



Submit