An alternative to downloading the individual library JARs yourself is to use Maven for dependency management. The Maven Android Plugin allows developers to utilize Maven's dependency management capabilities within an Android application. Additionally, the Maven Integration for Android Development Tools bridges the Maven Android Plugin and the Android Development Tools (ADT) to allow the use of dependency management within Eclipse.
The following Maven POM file illustrates how to configure the Maven Android Plugin and associated dependencies for use with Spring Android Rest Template.
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.springframework.android</groupId> <artifactId>showcase</artifactId> <version>1.0.0.BUILD-SNAPSHOT</version> <packaging>apk</packaging> <name>spring-android-showcase-client</name> <url>http://www.springsource.org</url> <organization> <name>SpringSource</name> <url>http://www.springsource.org</url> </organization> <build> <sourceDirectory>src</sourceDirectory> <finalName>${project.artifactId}</finalName> <plugins> <plugin> <groupId>com.jayway.maven.plugins.android.generation2</groupId> <artifactId>maven-android-plugin</artifactId> <version>2.8.4</version> <configuration> <sdk> <platform>3</platform> </sdk> <emulator> <avd>3</avd> </emulator> <deleteConflictingFiles>true</deleteConflictingFiles> <undeployBeforeDeploy>true</undeployBeforeDeploy> </configuration> <extensions>true</extensions> </plugin> <plugin> <artifactId>maven-compiler-plugin</artifactId> <version>2.3.2</version> </plugin> </plugins> </build> <dependencies> <dependency> <groupId>com.google.android</groupId> <artifactId>android</artifactId> <version>1.5_r4</version> <scope>provided</scope> </dependency> <dependency> <groupId>org.springframework.android</groupId> <artifactId>spring-android-rest-template</artifactId> <version>1.0.0.BUILD-SNAPSHOT</version> </dependency> <dependency> <!-- Using Jackson for JSON marshaling --> <groupId>org.codehaus.jackson</groupId> <artifactId>jackson-mapper-asl</artifactId> <version>1.7.1</version> </dependency> <dependency> <!-- Using Simple for XML marshaling --> <groupId>org.simpleframework</groupId> <artifactId>simple-xml</artifactId> <version>2.4.1</version> <exclusions> <exclusion> <artifactId>stax</artifactId> <groupId>stax</groupId> </exclusion> <exclusion> <artifactId>stax-api</artifactId> <groupId>stax</groupId> </exclusion> </exclusions> </dependency> <dependency> <!-- Using Android ROME for RSS and ATOM feeds --> <groupId>com.google.code.android-rome-feed-reader</groupId> <artifactId>android-rome-feed-reader</artifactId> <version>1.0.0-r2</version> </dependency> </dependencies> <repositories> <!-- For developing with Android ROME Feed Reader --> <repository> <id>android-rome-feed-reader-repository</id> <name>Android ROME Feed Reader Repository</name> <url>https://android-rome-feed-reader.googlecode.com/svn/maven2/releases</url> </repository> <!-- For testing against latest Spring snapshots --> <repository> <id>org.springframework.maven.snapshot</id> <name>Spring Maven Snapshot Repository</name> <url>http://maven.springframework.org/snapshot</url> <releases><enabled>false</enabled></releases> <snapshots><enabled>true</enabled></snapshots> </repository> <!-- For developing against latest Spring milestones --> <repository> <id>org.springframework.maven.milestone</id> <name>Spring Maven Milestone Repository</name> <url>http://maven.springframework.org/milestone</url> <snapshots><enabled>false</enabled></snapshots> </repository> </repositories> </project>
Once you have configured a Maven POM in your Android project you can use the following Maven command to clean and assemble your Android APK file. Additional goals are available for use with the Maven Android Plugin.
$ mvn clean install
The following command starts the emulator specified in the Maven Android Plugin section of the POM file
$ mvn android:emulator-start
Deploys the application package to the emulator
$ mvn android:deploy