Maven Android Plugin And Library Projects

643 views Asked by At

I have created an android application using maven-android-plugin, I want to use Android-ViewPagerIndicator and I've added dependency in the pom.xml.

<dependency>
  <groupId>com.viewpagerindicator</groupId>
  <artifactId>library</artifactId>
  <version>2.4.1</version>
  <type>apklib</type>
</dependency>

But my android application is giving compile errors if I use the classes from Android-ViewPagerIndicator.

TitlePageIndicator cannot be resolved to a type

I'm getting above error in eclipse.

Do I still need to download the library, import it to eclipse and reference it in the eclipse?

(Sorry if this is a stupid question, since this is my first Android-Maven Project)

2

There are 2 answers

5
Amir Keibi On

Eclipse's configuration ought to be changed in order to use the installed Maven, and its repository and settings instead of the embedded one. Go to "Window -> Preferences -> Maven -> Installations", add externally installed Maven to the list, and select it.

After this, right click on the Maven project -> Maven -> Update Project. Click "Select All" (right side) and make sure all options at the bottom of the dialog box are selected except "Offline". This should refresh your workspace with dependencies from your local Maven's repository.

0
drewan50 On

The trick is to configure/convert each library project to a Maven project as well. Once you do that your pom should have no trouble finding it.

Additionally, when you build using Maven.. first build each library project (mvn clean install) and then build the main solution.