android使用maven

We are using andorid-maven-plugin to simplify the dependent library management.  You won't be able to using some of the ADT features (e.g. Run or Debug As Android Application), and the following are the alternative or tips you can use.

Deploy

  1. Right click project root, and select Run As -> Maven build
  2. Enter clean package android:deploy as the goal (this is only needed the first time, since it will run whatever you configured before in the future runs)

Debug 

  1. Deploy your new code to emulator or device
  2. Launch the application (note that it doesn't start automatically after deployment)
  3. Go to DDMS view
  4. Look for your application in the device tab (it will list your app using the package name you put in AndroidManifest.com
  5. Select it then click on the debug icon
  6. Now use your app as usual, and it will stop at the breakpoints you set

Override pom.xml settings

You can add <profile> to your Maven's settings.xml if you want to use different settings without modifying pom.xml.  You will find the settings.xml in the conf folder in your Maven installation.  

  1. Add a profile like the following (name your profile to suite your needs)

    <profile>
         <id>kidsens-linux</id>
         <properties>
             <sdk.linux>/home/barry/dev/android-sdk-linux</sdk.linux>
             <sdk>${sdk.linux}</sdk>
         </properties>
    </profile>
  2. Run maven with -P kidsens-linux 
    1. you can reconfigure your existing run configuration by rick-click the project and select Run As -> Run Configurations ...
    2. find your maven build configuration and add it to the end of the goal (e.g. clean package android:deploy -P kidsens-linux) 

Whatever you put in the profile will override what is in pom.xml.  Note that putting profiles.xml along with pom.xml no longer works in Maven3.

 


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值