0

I am trying to add ViewPageIndicator library by Jake Wharton to my project's module. I know how to do this with a jar file but since this is a module I am not sure how to add it to the build.gradle file.

This is what my current structure looks like

ExampleProject (Root module) | ------> Example (main module that needs the library) | ------> PageIndicatorLibrary

2 Answers 2

2

Since this was marked as a popular question. In the hopes that this helps others as well I am posting an alternative answer.

If you import ViewPagerIndicator as a module and not a library. You can compile the project and add is as part of the dependency in the build.gradle file by adding the following to the dependencies section.

dependencies { compile project(':ViewPagerIndicator') } 
Sign up to request clarification or add additional context in comments.

Comments

1

Add something like this in your build.gradle

repositories { mavenCentral() } dependencies { compile 'com.viewpagerindicator:library:2.4.1' compile 'com.google.android:support-v4:r7' //transitive dependency of viewpagerindicator } 

From the viewPageIndicator project page :

This project depends on the ViewPager class which is available in the Android Support Library or ActionBarSherlock. Details for including one of those libraries is available on their respecitve web sites.

That's why I added the support lib in the dependencies (you may need another version)

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.