标签:android class http tar ext com
软件需求:
1.JDK 1.6+
2. Android SDk(r21.1 或者最新,版本越新支持越高)
3. Maven 3.1.1+
4. 添加环境到path,新建变量ANDROID_HOME,写上你的sdk的安装路径,例如
ANDROID_HOME:E:\installspace\Android\android-sdk;path变量中添加%ANDROID_HOME%\tools and %ANDROID_HOME%\platform-tools。
检测是否配置成功,控制台输入android,如出现Android Sdk Manager,则表示配置成功!
注意:maven 可能出现Android-maven-plugin不兼容;
有两种方式:
安装源:http://rgladwell.github.com/m2e-android/updates/
安装方法:Help -> Install new Software -> 在出来的对话框中点击 Add ->Name:m2e-android
Location:http://rgladwell.github.com/m2e-android/updates/
在Eclipse中菜单中找到help-Eclipse MarketPlace中点击,在弹出的对话框中,在search的tab页下,find的文本框输入“Android Configuration”,进行搜索,点击install安装。
新建一个Maven Project (File -> New -> Project... then select Maven -> Maven Project).
选中需要运行的项目,右键run as-run configurations,双击Maven Build
在Base directory 选择你所运行的项目路径,
Goals:clean install android:deploy android:run
点击run.
android create project --target <target-id> --name Myapp --path <path-to-workspace>/Myapp --activity MainActivity--package com.example.myfirstapp
将<target-id>换成你在刚刚显示的列表中显示的一个id值,将<path-to-workspace>换成应用存放的路径。
<profile> <id>android</id> <properties> <android.sdk.path> E:\installspace\Android\android-sdk </android.sdk.path> </properties> </profile>
在 <activeProfiles></activeProfiles>标签中加入
<activeProfile>android</activeProfile>
<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.example.myfirstapp</groupId> <artifactId>MyFirstApp</artifactId> <version>1.0.0</version> <packaging>apk</packaging> <name>MyFirstApp</name> <dependencies> <dependency> <groupId>com.google.android</groupId> <artifactId>android</artifactId> <version>4.1.1.4</version> <scope>provided</scope> </dependency> </dependencies> <build> <sourceDirectory>src</sourceDirectory> <finalName>${project.artifactId}</finalName> <pluginManagement> <plugins> <plugin> <groupId>com.jayway.maven.plugins.android.generation2</groupId> <artifactId>android-maven-plugin</artifactId> <version>3.8.2</version> <extensions>true</extensions> </plugin> </plugins> </pluginManagement> <plugins> <plugin> <groupId>com.jayway.maven.plugins.android.generation2</groupId> <artifactId>android-maven-plugin</artifactId> <configuration> <sdk> <!-- platform as api level (api level 16 = platform 4.1)--> <platform>16</platform> </sdk> </configuration> </plugin> </plugins> </build> </project>在pom.xml中如下修改,
设置version标签,例如 <version>0.1.0-SNAPSHOT</version>.
mvn clean install
mvn android:deploy
clean install android:deploy android:run
使用maven对android项目进行构建,布布扣,bubuko.com
标签:android class http tar ext com
原文地址:http://www.cnblogs.com/zust-zbt/p/3784295.html