Maven开发Android指南 2 配置android-maven-plugin

锺霍英
2023-12-01

在尝试开发或编译Android应用之前,你需要安装和配置JDKAndroid SDKMaven

 

必备条件:

JDK 1.6+

Android SDK (r17 or later) 支持所有版本的开发。http://developer.android.com/sdk/index.html

Maven 3.0.3+http://maven.apache.org/download.html

 

配置步骤:

JDK:

JDK的安装配置不在本文介绍,可参考http://docs.oracle.com/javase/7/docs/webnotes/install/windows/jdk-installation-windows.html

 

CMD中键入java -version。测试是否安装成功:

java version "1.6.0_22"

Java(TM) SE Runtime Environment (build 1.6.0_22-b04)

 

Maven For Windows:

 

假定下载Maven后,解压到目录c:\Program Files\apache-maven-3.0.3

使用Windows控制面板配置环境变量(可参照JDK配置):

配置M2_HOMEM2_HOME=c:\Program Files\apache-maven-3.0.3+

配置PATHPATH=%PATH%;%M2_HOME%\bin+ …

 

CMD中键入mvn -v。测试是否安装成功:

Apache Maven 3.0.4 (r1232337; 2012-01-17 16:44:56+0800)

Maven home: C:\Program Files\apache-maven-3.0.3\bin\..

Java version: 1.6.0_22, vendor: Sun Microsystems Inc.

Java home: C:\Program Files\Java\jdk1.6.0_22\jre

Default locale: zh_CN, platform encoding: GBK

OS name: "windows xp", version: "5.1", arch: "x86", family: "windows"

 

Android SDK For Windows:

 

Android官网(Android Developer web site)下载SDK

 

假定下载Android后,解压到目录D:\android\android-sdk-windows

使用Windows控制面板配置环境变量(可参照JDK配置):

配置ANDROID_HOMEANDROID_HOME=D:\android\android-sdk-windows

配置PATHPATH=%PATH%;%ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools;

 

参考:

http://code.google.com/p/maven-android-plugin/wiki/GettingStarted

http://docs.oracle.com/javase/7/docs/webnotes/install/windows/jdk-installation-windows.html

http://www.sonatype.com/books/mvnref-book/reference/installation-sect-maven-install.html#installation-sect-windows

http://www.sonatype.com/books/mvnref-book/reference/installation-sect-test-install.html

http://www.sonatype.com/books/mvnref-book/reference/android-dev-sect-config-build.html

http://developer.android.com/sdk/exploring.html

 类似资料: