Software Requirements:
1.JDK 1.6+
2. Android SDk(r21.1 or up-to-date, the newer version supports the higher)
3. Maven 3.1.1+
4. Add the environment to path, create a new variable android_home, and write the installation path of your SDK, for example
ANDROID_HOME:E:\INSTALLSPACE\ANDROID\ANDROID-SDK; add%android_home%\tools and%android_home%\platform-tools to the path variable.
Detect if configuration is successful, console input Android, if Android Sdk Manager appears, the configuration is successful!
Note: Maven may appear android-maven-plugin incompatible;
Eclipse BuildInstalling the MAVEN for Android plugin
There are two ways of doing this:
- Installing the [m2e-android][1] plugin in eclipse
Installation Source: http://rgladwell.github.com/m2e-android/updates/
Installation method: Help, install new software, in the dialog box, click Add->name:m2e-android
location:http://rgladwell.github.com/m2e-android/updates/
-
In the Eclipse menu found in the Help-eclipse marketplace click, in the popup dialog, in the Search tab page, find text box to enter "Android Configuration", to search, Click Install installation.
New MAVEN Project Project
-
Create a new MAVEN project (File-New project ... then select Maven---maven project).
- In the Select archetype interface, click Add archetype ...
- In archetype Group Id, enter "De.akquinet.android.archetypes"
- Enter "Android-quickstart" in archetype Artifact Id.
- Enter "1.1.0" in archetype Version and next
- Propertyies:platform:16 (default) emulator:not-specified android-plugin-version 3.8.2
- Finish.
Run Project
Select the project you want to run, right-run As-run configurations, double-click Maven Build
Select the project path you are running in base directory,
Goals:clean Install Android:deploy Android:run
Click Run.
Command Line Build
- Create project with Android tool
- This shows the available Android platforms, find the flat you want To compile your application, note the target ID and recommend the highest version.
- In Maven's ~/.m2/setting.xml, add the following to the Profiles tab to configure the path of the Android SDK.
Add to the <activeProfiles></activeProfiles> tab
<activeProfile>android</activeProfile>
- Add the file Pom.xml to the app as follows:
- Build apk
MVN clean Install
- Deploy the APK to the device
MVN Android:deploy
- Run directly
Clean install Android:deploy Android:run