I'm trying to use Jake Wharton's ViewPagerIndicator library, but I'm unable to get it working with my Gradle project in Android Studio.
I add it as a dependency like so:
dependencies {
// ... other ommitted
compile 'com.viewpagerindicator:library:2.4.1'
compile 'com.android.support:support-v4:19.0.1'
compile 'com.nineoldandroids:library:2.4.0'
// ...
}
but the project doesn't seem to recognize any components in the library. I'm wondering if there's a dependency issue with different support-v4 versions or something in nineoldandroids...?
This is what worked for me:
i.e, do not use the repo URL.
then use:
To sum up: you can search "ViewPagerIndicator" in http://mvnrepository.com/, you will find out the original com.viewpagerindicator doesn't have the red marker "Android Packages", so you cannot use it with Gradle. You can find another one with the red marker, make sure it has the same version as the original one. (i.e. some one create an android package based on the original one)
Jitpack.io is great for this situation.
First, add the following repository:
Then, just add the dependency pointing to the GitHub repo:
The post marked as answer didn't work for me...Gradle complained about "Connection refused".
Considering that it looks like it's stable after all this time, I just download the aar file from https://bintray.com/populov/maven/com.viewpagerindicator:library, copied into my libs folder, and referenced it like so:
Please check this first
Android Studio - UNEXPECTED TOP-LEVEL EXCEPTION:
if these checks are ok do mentioned below.
No need to include support-v4 as dependency of your module because ViewPagerIndicator library already having support-v4 as its dependency. So you can try to remove that and do sync with gradle using tiny lovely gradle button available in toolbar -
Update your question if you are getting any error in syncing.
UPDATED :
I am not sure but It might be a problem I did not find any ViewPagerIndicator Library based on gradle. JackWarton has moved actionbarsherlock in gradle but ViewPagerIndicator still using maven.
For me also any of the above solution didn't worked. But this worked for me.
Just include the required librabry from here Viewpagerindicator Library
Include this in your app module's build.gradle (you won't have repository there just include it above dependencies.