Java桌面和Android应用程序在同一时间 - 共享套餐 [英] java desktop and android application at the same time - shared packages

查看:167
本文介绍了Java桌面和Android应用程序在同一时间 - 共享套餐的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要创建有​​两个版本的应用程序:一个用于台式机 - Java标准版,一个为Android。作为GUI是非常简单和逻辑的很大一部分将可能独立于平台(仅用于基本的Java包)。我想,当然分享这一主要的核心组成部分。

I want to create an application having two versions: one for desktop - java standard edition, and one for android. As GUI would be quite simple and huge part of logic would be probably platform independent (only basic Java packages used). I would like of course to share this main core part.

这样的问题:
我应该如何构建我的Eclipse项目? 3个项目:机器人,standardEdition,核心是什么?或者,我可以把一切都在一个项目中有两个不同的目标平台,如果是如何做到这一点?

Thus question: How should I construct my project in Eclipse? 3 projects: android, standardEdition, core? Or can I put everything into one project with two different destination platforms and if yes how to do that?

如何学习Android和standardEdition工程学会使用共享的核心项目?

How to learn android and standardEdition project to learn to use shared core project?

推荐答案

我会用3项目的做法。正如你已经说了,让为核心的一个单独的项目。 (API)

I would use the 3-project approach. As you have already said, make a seperate project for the core. (API)

这样,你还可以创建只有核心单元测试和您的设置仍然会显得干净。
你应该添加到核心项目是一个Ant文件或类似的生成从项目一个jar文件的东西,从而有可能给你​​的核心导入到其他项目。另一个优点是,在核心中使用的任何文库,将只需要在那里的进口,为核心的进口将使用这些

That way you can also create unit test for the core only and your setup will still look clean. What you should add to the 'core' project is an ant file or something similar to generate a jar file from the project, thus making it possible to import your core into the other projects. Another advantage is that any library used in the core, will only have to be imported there, as the import of the core will use those.

这篇关于Java桌面和Android应用程序在同一时间 - 共享套餐的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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