There are two ways to create a MAVEN project, as described in https://code.google.com/p/maven-android-plugin/wiki/GettingStarted.
The first method is to use archetype, but after I use it, I find that the project generated by archetype has a dependency that cannot be found, regardless of the other methods.
The second method is to use the Android command line to create the project, and then copy the example code project POM file and modify,
Ubuntu 14.04 Setup Android development environment describes how to create a project with the command line
Ubuntu 14.04 Android uses maven One example engineering to introduce examples of engineering helloflashlight
Create a project first Mvn_example1
Android Create Project--target android-10--name mvn_example1--path mvn_example1--activity mainactivity--package org.c Sfreebirdcreated Project Directory:mvn_example1created Directory/home/dean/work/gitlab_cloud/android/example/mvn_ example1/src/org/csfreebirdadded file mvn_example1/src/org/csfreebird/mainactivity.javacreated directory/home/ Dean/work/gitlab_cloud/android/example/mvn_example1/rescreated Directory/home/dean/work/gitlab_cloud/android/ Example/mvn_example1/bincreated directory/home/dean/work/gitlab_cloud/android/example/mvn_example1/libscreated directory/home/dean/work/gitlab_cloud/android/example/mvn_example1/res/valuesadded file mvn_example1/res/values/ strings.xmlcreated directory/home/dean/work/gitlab_cloud/android/example/mvn_example1/res/layoutadded File Mvn_ example1/res/layout/main.xmladded file mvn_example1/androidmanifest.xmladded file mvn_example1/build.xmladded file Mvn_example1/proguard-project.txt
Now copy the Heelloflashlight pom.xml file into the project directory, and then modify some of these configurations:
<groupId>org.freebird</groupId> <artifactId>example1</artifactId> <version >1.0.0</version> <packaging>apk</packaging> <name>mvn_example1</name>
Set the platform version to 10, the use of the API level, you can also use the platform level:2.3.3, the specific can be ordered by the Android list targets, but there is currently only set 16, set 10 will fail, Don't understand the reason for the moment.
<plugins> <plugin> <groupid>com.jayway.maven.plugins.android.generation2</groupid > <artifactId>android-maven-plugin</artifactId> <configuration> <sdk> <!--platform as API level (API level = Platform 4.1)- <platform>10</platform> </ sdk> </configuration> </plugin> </plugins>
Delete Ant-related files:
mvn_example1$ Rm-r bin build.xml build.properties libsrm:cannot remove ' build.properties ': No such file or directory
After you start the emulated device, run the following command to compile and deploy:
MVN Clean INSTALLMVN Android:deploy
After successful deployment, you will see the program icon appear on the emulated device.
Click Run, success.