Maven
一个项目管理工具,类似于Ant。相比Ant,Maven更强大,编写起来更简洁,并引入了仓库的概念。
官网:http://maven.apache.org/
配置构建环境
1.安装Android SDK
到http://developer.android.com/sdk/index.html
下载并SDK Management.
下载需要的android平台版本,和对应版本的google api.
在系统环境变量中添加ANDROID_HOME变量,指向SDK根目录。还可以在Path中添加%ANDROID_HOME%\tools。
2.安装Maven Android SDK deployer工具
到http://github.com/mosabua/maven-android-sdk-deployer
下载项目源码,解压到任意目录下。
定位到项目目录,执行以下命令:
// 如果你的SDK下载了完整的组件
mvn clean install
// 如果你想指定某个平台
mvn clean install -P 2.2
3.配置settings.xml
为了能在命令行中使用简短的插件名-android,你需要修改settings.xml如下:
<pluginGroups>
<pluginGroup>
com.jayway.maven.plugins.android.generation2
</pluginGroup>
</pluginGroups>
在Android开发中使用Maven
在原有的Android目录下添加pom.xml文件,文件内容格式如下:
<?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.demo.quartzclock</groupId>
<artifactId>quartzclock</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>apk</packaging>
<name>QuartzClockDemo</name>
<dependencies>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<version>2.2.1</version>
<scope>provided</scope>
</dependency>
</dependencies>
<repositories>
<repository>
<id>sonatype</id>
<name>Sonatype Repository</name>
<url>https://repository.sonatype.org/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<layout>default</layout>
</repository>
</repositories>
<build>
<finalName>${project.artifactId}</finalName>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>maven-android-plugin</artifactId>
<version>2.8.4</version>
<configuration>
<sdk>
<!-- platform or api level (api level 4 = platform 1.6)-->
<platform>8</platform>
</sdk>
<emulator>
<!-- the name of the avd device to use for starting the emulator -->
<avd>android2.2_HVGA</avd>
</emulator>
<deleteConflictingFiles>true</deleteConflictingFiles>
<undeployBeforeDeploy>true</undeployBeforeDeploy>
</configuration>
<extensions>true</extensions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<!-- version 2.3 defaults to java 1.5, so no further configuration needed-->
<version>2.3</version>
</plugin>
</plugins>
</build>
</project>
Eclipse插件:Maven Android Plugin
请参考:
m2eclipse-android-integration
GettingStarted:http://code.google.com/a/eclipselabs.org/p/m2eclipse-android-integration/wiki/GettingStarted
maven-android-plugin
GettingStarted:http://code.google.com/p/maven-android-plugin/wiki/GettingStarted
------------------------------------------------------------------------------------------------------
由于本身Android的Manifest.xml已经配置了构建的属性,感觉Maven在这起的作用不大...
分享到:
相关推荐
Maven更新问题 今天Maven在更新的时候发现一直更新不成功,总结下解决方法。 在apache-maven-3.5.2/conf/setting.xml中加入以下配置即可解决 alimaven aliyun maven ...
Some modules of project contain dependencies not included in Maven Central - to build such modules you need first install these dependencies in your local repository. To do this, please, download ...
filepicker-android Android version of Filepicker. Allow your users to pull in their content from Dropbox, Facebook, and more! ...The library provides an activity that your app...If you use Maven, you can in
Latest Javadoc for 1.4.9 release are available here (also included in Maven repository): https://loopj.com/android-async-http/doc/ Features Make asynchronous HTTP requests, handle responses in ...
解决 Android Studio 3.0 加载项目过慢问题 - Maven 仓库选择 Android Studio 3.0 加载项目过慢问题是许多开发者遇到的一个常见的问题。这个问题的出现主要是由于 Maven 仓库的配置不当所致。在本文中,我们将介绍...
For android maven plugin specific help please see the official website: http://code.google.com/p/maven-android-plugin/ There is a matching application server side to this code written in Python. It ...
Material file picker library for Android Using Add repository url and dependency in application module gradle file: repositories { maven { url "http://dl.bintray.com/lukaville/maven" } } ...
in your project's POM file or in your settings.xml file. Where you put the plugin settings depends on whether you want a specific setting to be configured globally or on a per-project basis. All GitHu
There are two ways you can add MathView to your project in Android Studio: From a remote Maven repository (jcenter). From a local .aar file. 1. Setup from a remote Maven repository (jcenter) Add ...
This library is not released in Maven Central, but instead you can use JitPack add remote maven url in allprojects.repositories allprojects { repositories { maven { url "https://jitpack.io" } } } ...
Latest Javadoc for 1.4.9 release are available here (also included in Maven repository): https://loopj.com/android-async-http/doc/ Features Make asynchronous HTTP requests, handle responses in ...
**第二步**:在没有互联网连接的电脑上安装Android Studio,并将之前下载的所有资源文件复制到该电脑上,随后配置maven本地依赖,以便在无网络的情况下也能顺利进行Android应用的开发与测试。 #### 二、准备工作与...
This library is available in jitPack which is the default Maven repository used in Android Studio. Gradle Step 1. Add it in your root build.gradle at the end of repositories allprojects { ...
See ProductLayer in action in our prod.ly app. We have SHUT DOWN https://www.cocoanetics.com/2018/04/productlayer-post-mortem/ Usage Gradle compile 'com.productlayer.ply-android-sdk:0.5.1' compile '...
maven { url 'https://jitpack.io' } } } // 2. Add the dependency in your app/build.gradle dependencies { compile 'com.github.fashare2015:StackLayout:1.0.0' } xml布局 父布局使用clipChildren="false...
This library implements the Disqus API for use in Android applications. This librar is ongoing Gradle settings repositories { maven { url 'https://dl.bintray.com/jjhesk/maven' } } dependencies { ...
The library is be available both in Maven Central and JCenter. To start using it add this line to your build.gradle dependencies file: implementation 'com.auth0.android:jwtdecode:1.2.0' Usage Decode a...
Add Jitpack in your root build.gradle at the end of repositories: allprojects { repositories { ... maven { url "https://jitpack.io" } } } Add to your dependencies: dependencies { compile '...
A simple indicator with fading animation for ViewPager in Android. Most of the existing indicators don’t provide a smooth transition, this library fades indicators in and out when pager flipped. ...