androidmavenandroid-maven-plugin

how to start using android-maven-plugin?


First steps to use the android-maven-plugin?


Solution

  • 1 Set android home

    export ANDROID_HOME=/your/android-SDK/path
    

    2 Run

    mvn archetype:generate -DarchetypeArtifactId=android-with-test 
    -DarchetypeGroupId=de.akquinet.android.archetypes -DarchetypeVersion=1.0.9 
    -DgroupId=org.me -DartifactId=myAndroidApp -Dplatform=8
    

    Here To check the archetypeVersion or look for other ones.

    3

    Edit myAndroidApp/pom.xml (parent level pom.xml) to set (it is initially void)

    <platform.version> 2.2.1 </platform.version>
    

    in the properties section. Please make sure the correspondence between platform 8 and platform.version 2.2.1 You can learn in your android sdk manager app that API 8 <-> 2.2, but must visit here to see that the final number is 2.2.1. (Note: for API 10 <-> 2.3.3).

    4

    You can start right now to play with it. In the parent directory:

    mvn clean install
    

    and to run it (in myAndroidApp/myAndroidApp directory)

    cd myAndroidApp
    mvn android:run
    

    Be sure you started a phone emulator or attached a real phone (in debug mode) to your computer.

    Hope this saves you a whole weekend! (Too late for me ;-) )