Maven搭建Android开发环境

 

一、下载安装 ADT Bundle

        下载:http://developer.android.com/sdk/index.html

        安装:解压即可

 

二、安装插件:Eclipse Marketplace

 

三、安装插件:Android Configurator for M2E

 

四、设置环境变量:ANDROID_HOME

        例如:ANDROID_HOME=D:\Java\adt-bundle-windows-x86_64-20130522\sdk

 

五、设置环境变量:PATH

        将 %ANDROID_HOME%\tools; 与 %ANDROID_HOME%\platform-tools; 添加到PATH下

        例如:PATH=%ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools;

 

六、下载安装:maven-android-sdk-deployer

        地址:https://github.com/mosabua/maven-android-sdk-deployer

        安装:

cd maven-android-sdk-deployer-master
mvn clean install

        或 - 指定版本

cd maven-android-sdk-deployer-master
mvn clean install -P 4.2

 

七、新建Android工程:HelloAndy

    AndroidManifest.xml




    

    
        
            
                

                
            
        
    

 

    project.properties

# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system edit
# "ant.properties", and override values to adapt the script to your
# project structure.
#
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt

# Project target.
target=android-17

  

八、转换成Maven工程

       项目 --> 右键 --> Configure --> Convert to Maven Project

 

九、修改pom.xml配置


	4.0.0
	HelloAndy
	HelloAndy
	0.0.1-SNAPSHOT
	apk
	
		
			com.google.android
			android
			2.3.3
			provided
		
	
	
		UTF-8
	
	
		${project.artifactId}
		
		
			
				
					com.jayway.maven.plugins.android.generation2
					android-maven-plugin
					3.6.0
					true
				
			
		
		
			
				
                    com.jayway.maven.plugins.android.generation2
                
				android-maven-plugin
				
					${project.basedir}/AndroidManifest.xml
					${project.basedir}/assets
					${project.basedir}/res
					${project.basedir}/src/main/native
					
						true
					
					
						17
					
					
						16
					
					true
					true
				
			
			
				org.apache.maven.plugins
				maven-compiler-plugin
				3.1
				
					1.6
					1.6
					${project.build.sourceEncoding}
					true
					true
					true
				
			
		
	

  

十、打包测试

>mvn clean install android:apk

 

 

待续.... 

你可能感兴趣的:(Maven,Android)