如何在eclipse中构建Maven Android项目 [英] How to build a Maven Android project in eclipse

查看:100
本文介绍了如何在eclipse中构建Maven Android项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在测试代码: https://github.com/nkzawa/socket.io-client。 java的。在功能下,有一个甜蜜的声音线:Android完全支持。但是,对于魔法师来说,这是完全新鲜的,我可以使头脑和尾巴都不能说明。如何使用此代码构建基本的Android测试项目?只需将repo中的源代码添加到我的项目中就会出现很多错误。

解决方案

Android for Maven Eclipse 连接器是一个Maven Eclipse(m2e)插件,为Android开发人员工具(ADT)和Maven Android插件添加了maven支持。它将Maven依赖管理的力量带入ADT。


  1. 开始之前



    您将需要安装Eclipse Indigo或Juno。


  2. 安装Android连接器 / p>


    • 您可以通过Eclipse Marketplace安装Maven的Android连接器。选择帮助 - > Eclipse Marketplace ...并搜索android m2e。


    • 单击出现并遵循的Android Connector for Maven旁边的安装按钮通过向导对话框安装插件及其依赖关系的路径(包括Android Development Toolkit和Maven for Eclipse m2e插件)。接受条款和条件,然后单击完成。


    • 重新启动Eclipse工作区后,您应该可以开始使用Android连接器。



  3. 创建Eclipse项目




    • 如果您已经有一个Android项目,请确保您已使用3.0.0版或更高版本的maven-android-plugin为您的项目创建了一个POM。


    • 然后右键单击您的项目,然后选择配置 - >转换为Maven项目。








如果您从一个新项目开始,您可以使用Maven Android原型完全创建Android项目Eclipse:

  1。创建一个新的Maven项目(文件 - >新 - >项目...然后选择Maven  - > Maven项目)。 
2.当提示选择原型时,单击添加原型...
3.在出现的对话框中,为原型组ID输入de.akquinet.android.archetypes。
4.在Archetype Artifact Id中输入android-quickstart。
5.在原型版本中输入1.0.10并继续。
6.当提示输入所需的项目组和工件ID,版本,并可选择为Android版本设置platform属性(默认为16)。
7.单击完成

无论哪种方式,您应该最终得到一个Eclipse项目,这个:




I am testing the code here : https://github.com/nkzawa/socket.io-client.java. Under features there is this sweet sounding line : "Android is fully supported". But being completely new to maven I can make neither head nor tail of the instructions. How do I build a basic Android test project with this code? Simply adding the source code from the repo to my project is showing lot of errors. If there is a command line way of doing this that would be fine too.

解决方案

The Android for Maven Eclipse connector is an Maven Eclipse (m2e) plug-in that adds maven support for Android Developer Tools (ADT) and the Maven Android Plugin. It brings the power of Maven dependency management into the ADT.

  1. Before you start

    You will need Eclipse Indigo or Juno installed.

  2. Install Android Connector

    • You can install the Android Connector for Maven via the Eclipse Marketplace. Select Help -> Eclipse Marketplace... and search for "android m2e".

    • Click the Install button next to the Android Connector for Maven that appears and follow the path through the wizard dialog to install the plug-in and its dependencies (including the Android Development Toolkit and the Maven for Eclipse m2e plug-in). Accept the terms-and-conditions and click Finish.

    • Once you restart your Eclipse workspace you should be ready to start using the Android Connector.

  3. Create Eclipse project

    • If you already have an Android project please make sure you have created a POM for your project using version 3.0.0 or greater of the maven-android-plugin.

    • Then right-click on your project and select Configure -> Convert to Maven Project.


If you are starting with a new project you can use the Maven Android archetypes to create Android projects completely within Eclipse:

1. Create a new Maven Project (File -> New -> Project... then select Maven -> Maven Project).
2. When prompted to Select Archetype click Add Archetype...
3. In the dialog that appears enter "de.akquinet.android.archetypes" for Archetype Group Id.
4. In Archetype Artifact Id enter "android-quickstart".
5. In Archetype Version enter "1.0.10" and continue.
6. When prompted enter your desired project group and artifact ID, version and, optionally, set the "platform" property for the Android version (defaults to '16').
7. Click Finish

Either way you should end up with an Eclipse project looking something like this:

这篇关于如何在eclipse中构建Maven Android项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆