建立在Eclipse上的Andr​​oid应用模块 [英] Creating Android Modular Applications on Eclipse

查看:148
本文介绍了建立在Eclipse上的Andr​​oid应用模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在移植的基础上J2ME应用程序到Android的框架。该框架包括编译成库(罐)几个项目。每个单独的JAR可以包含图形数据(资源,J4ME屏等)。每个项目一般都有一个明确的入口点(模块)。当有人想使用这个框架来构建应用程序,他必须只创建一个MIDlet项目并添加库依赖,并使用导入的类。

I am currently porting a framework for building applications on J2ME to Android. This framework consists of several projects that compile to libraries (jars). Each individual JAR can contain graphical data (resources, J4ME screens, etc.). Every project generally has a well defined entry point (module). When someone wants to build an application using the framework he must only create a Midlet project and add library dependencies and use the imported classes.

我们一直在使用同样的方法来开发Android框架。在这种情况下,我们只用普通的Java项目在Eclipse编译成罐子库。这些项目有依赖了Android框架(的android.jar)。当建立一个新的应用程序,我们建立在Eclipse的Andr​​oid项目,并添加依赖关系。

We have been using the same approach to develop the Android framework. In this case we have only used normal Java Projects inside Eclipse that compile to jar libraries. These projects have dependencies with the Android Framework (android.jar). When building a new application we create an Android Project inside Eclipse and add the dependencies.

我们的下一步是为Android也可以包含图形信息(活动,对话框,文本,可绘制等)构建更高级的模块。到目前为止,只有一个Android的Eclipse项目需要(终端应用),包含所有的图形相关的类和资源。看来,使用的资源(文字,可绘等)时,唯一的方法是创建一个Android应用程序,因为资源是唯一可参考由ADT插件(R.XXX)自动创建一个整数处理方式。所以建立图形模块可能无法通过普通的Java JAR项目的手段来构建。

Our next step is to build more advanced modules for Android that can also contain graphical information (Activities, Dialogs, Literals, Drawables, etc.). So far only an Android Eclipse project was needed (the end application), that contained all the graphical-related classes and resources. It seems that when using resources (literals, drawables, etc.) the only approach is to create an Android Application, since the resources are only referenceable by means of an integer handler automatically created by ADT plugin (R.XXX). So building graphical modules may not be built by means of plain Java jar projects.

Android开发者的信息解释说,模块化的应用是可行的,但我还没有找到一个简明教程讲解过程中,但一些小技巧,例如如何prevent一个错误ocurr时的应用程序调用其他应用程序提供的意图。构建利用资源,从其他应用程序的应用程序时,这是有效的。我没有在系统上需要多个安装的应用程序,但是从几个组件之一建造的。

Android developer information explains that modular applications are feasible, but I have not found a concise tutorial explaining the process, but some tips such as how to prevent an error to ocurr when an application invokes an intent made available by other application. This is valid when building applications that use resources from other applications. I do not need several installed applications on the system, but one built from several components.

有没有人经历类似requierements发展?任何好的教程或提示,开始了呢?

Has anyone experience developing with similar requierements? Any good tutorial or tips to start out?

推荐答案

看来,唯一可用的方法是描述的此处作为暗示由<一个href="http://stackoverflow.com/questions/3608680/is-is-possible-at-build-time-to-merge-android-applications">the接受了这个其他问题的答案。

It seems that the only available way is described here as hinted by the accepted answer of this other question.

然而,解决方案是相当新的(它仅适用于最新的Andr​​oid SDK tooks R6和SDK 2.0.X被排除在外的支持)。它有一些重要的注意事项上,我希望谷歌已经着手:

The solution however is rather new (it only works with latest Android SDK tooks R6 and SDKs 2.0.X are left out of support). It has some major caveats on which I hope Google is already working:

  • 没有二进制库链接。这意味着主应用程序需要访问资源(在Eclipse意味着让所有的链接库工程开)。
  • 资源(布局,可绘制等)的名称是全球治疗。这意味着,如果你有两个main.xml中的布局,只有最相关的(最上面的库列表)将被使用。
  • 缺少funcionalities /虫子。导出的库项目的活动文档状态只能在库项目的Andr​​oidManifest.xml中声明。这的不能在当前版本中工作的。内井字游戏的示例注释暗示,这是所希望的工作,但是对于当前的从库项目的Andr​​oid工具的使用发布活动必须在主应用程序项目的Andr​​oidManifest.xml中明确定义。
  • No binary library linking. This means that the main application needs access to sources (in Eclipse implies having all the linked library projects open).
  • The names of resources (layouts, drawables, etc) are treated globally. This means that if you have two "main.xml" layouts, only the most relevant (uppermost in library list) will be used.
  • Missing funcionalities/BUGs. The documentation states that exported activities of a library project must only be declared in AndroidManifest.xml of library project. This does not work in current version. Comments inside TicTacToe example hints that this is the desired working, but for current release of Android Tools used activities from library projects must be explicitly defined in AndroidManifest.xml of main application project.

这篇关于建立在Eclipse上的Andr​​oid应用模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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