1.1 安装maven
从官网 http://maven.apache.org/download.html 下载最新的maven包,解压后放到某个目录。
(linux:/usr/local/apache-maven-3.0.4;windows:c:\apache-maven-3.0.4);
1.2 安装android sdk
linux:/Users/guanjianjun/android-sdks
Windows:c:\program files\android\android-sdk
1.3 安装jdk
1.4 设置环境变量
Linux:
export M2_HOME=/usr/local/apache-maven-3.0.4
export M2=$M2_HOME/bin
export MAVEN_OPTS="-Xms256m -Xmx512m"
export ANDROID_HOME=/Users/guanjianjun/android-sdks
export PATH=$M2:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:/opt/local/bin:/opt/local/sbin:/usr/local/mysql/bin:$PATH
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_07.jdk/Contents/Home
export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/lib/tools.jar
Windows:
在‘我的电脑’->‘属性’-> ‘高级系统设置’ -> ‘高级’-> ‘环境变量下’添加如下环境变量。
ANDROID_HOME=C:\Program Files\Android\android-sdk
JAVA_HOME=C:\Program Files\Java\jdk1.7.0_07
CLASSPATH=%JAVA_HOME%\lib;%JAVA_HOME%\lib\tools.jar
M2_HOME=C:\apache-maven-3.0.4
M2=%M2_HOME%\bin
MAVEN_OPTS=” -Xms256m -Xmx512m”
PATH后面加上
%JAVA_HOME%\bin;%ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools;%M2%
>mvn clean install
**不出意外的话就能生成apk了。