|
GettingStarted
Get started using Maven Android Plugin
Getting StartedMaven Repository
Setup your development environment
http://developer.android.com/sdk/1.5_r2/ <dependency>
<groupId>android</groupId>
<artifactId>android</artifactId>
<version>1.5_r2</version>
<scope>provided</scope>
</dependency>This corresponds to the android.jar file in the Android SDK which is needed to compile all Android applications. Install this file to your local repository with the following command. mvn install:install-file -DgroupId=android -DartifactId=android -Dversion=1.5_r2 -Dpackaging=jar -Dfile=$ANDROID_SDK_15/platforms/android-1.5/android.jar On Windows, that would be: mvn install:install-file -DgroupId=android -DartifactId=android -Dversion=1.5_r2 -Dpackaging=jar -Dfile=%ANDROID_SDK_15%/platforms/android-1.5/android.jar Optional: Test your development environmentIf you want to test your environment, download and run the Samples*. Create your own Android application (apk)
mv src java
mkdir -p src/main
mv java src/main/or if you don't want to change the directory structure, just add "sourceDirectory
to pom.xml.
rm -r bin build.xml build.properties libs The default.properties file is currently not used by Maven Android Plugin, but will be, so leave that in place for now. default.properties and the gen folder are used by the ADT plugin in Eclipse, if you use that. mvn install mvn com.jayway.maven.plugins.android.generation2:maven-android-plugin:deploy Do you think that last Maven command was long? It was. Check out TipsAndTricks. Run instrumentation tests on deviceCheck out the apidemos-15-instrumentationtest project in Samples*. You can create a project like that, by moving your "test" folder out and renaming it to for example "myproject-instrumentationtest". Then rearrange the folders within it like above, and use the pom.xml from apidemos-15-instrumentationtest as template. More documentationThere is some more documentation on the Documentation page. (*) SamplesAlways use the version of samples linked from the Samples page, so that you get a usable version of its configuration. Please feel free to update this page with more details / corrections! (Just ask hugo@josefson.org for edit permissions, and you will get it.) |
Sign in to add a comment
hi there,
I had to set the version of the jayway maven-android-plugin to 2.1.0 instead of 2.1.1-snapshot, as configured in the just downloaded samples. In the maven repository I only found 2.1.0:
http://repo2.maven.org/maven2/com/jayway/maven/plugins/android/generation2/maven-android-plugin/
to be complete, new pom.xml: .. <plugin>
.. etc.Hi Dirk,
Thank you for your comment!
I made a mistake in not specifying clearly that the "master" version of samples in git are not useful to an Android application developer, but the released version from the Samples page must be used instead.
I have now added an asterisk to all mentionings of the Samples on this page, and a footnote reminding that it is important to always use the linked version of samples from the Samples page.
An "Important note" is added to the Samples page. A full explanation is available on the Source page, where I believe most people might have been tricked into using a not-yet-released version of the samples.
Thanks, Hugo