Developing Android apps with Maven

Start

Now after more than one month my first post in my blog. I hope the time until the next blog will be shorter…

The last weeks I tried to set up an Android project with Maven. I’m using Maven 3.0.3 and use the android-maven-plugin from akquinet. So I generated a new project using the release project template from akquinet (de.akquinet.android.archetypes:android-archetype-project:1.0.7).

The project generates without problems inside my NetBeans IDE (I’m still using 7.0.1). When now trying to create a release (without any further configuration except the keystore) the build will fail.

First problem

The <distributionManagement> and the <scm> elements must be configured in the pom. This errors are already shown when you call

mvn release:prepare

Next problem

The proguard configuration has android-classes instead of classes in the <injars> element.

Another problem

The configuration of the JRE in the profiles did not work for me on Linux. I had to remove the /jre part of the path.

After adjusting this parts (which I’ve already described in a reply on the blog entry at akquinet you can build a release.

The only thing is that no site is generated with the release because the default site plugin used is 2.3 and Maven 3 does not work with this…

Building the site

To build the site you have to update the version of the site plugin to 3.0 (and the project info reports plugin 2.4). If you simple add this plugin to the build section and try to create a release it will fail…

The problem

The problem here is that the project info report tries to create a dependency report and this fails.

This is because the android-maven-plugin attaches the jar from the application as a dependent artifact to the apk artifact. But for the jar there exists no pom therefore the report does not find this dependency.

This only occurs during the release but during a default site-deploy only a warning is displayed…

After configuring the project info report to not generate the dependencies report a release will work.

What next

The android-maven-plugin has some more features to configure which I will explain in one of my next posts.

Additionally I want to create an archetype with further configuration. When this archetype is finished I’ll post it here with an explanation.

Leave a Reply

Your email address will not be published. Required fields are marked *