在Eclipse中多依赖机器人项目 [英] multiple dependent android projects in eclipse

查看:208
本文介绍了在Eclipse中多依赖机器人项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚开始用Android开发人员和Java +日食玩是pretty的新的我。我设法创建简单的项目,我的设备上运行。现在,我要创建简单的游戏(更多的人实际上),我喜欢使用共享code基地为所有这些(游戏循环,初始化等)。

I just started to play with android dev and java+eclipse is pretty new to me. I managed to create simple project and run it on my device. Now I want to create simple game (more of them actually) and I would love to use shared code base for all of them (game loop, initialization, etc..).

问题是,我不知道如何正确地做到这一点。我创建了一个名为引擎,我需要,并使其在设备上工作的所有基本的东西的Andr​​oid项目。现在我试图创造同一工作区称为mygame另一个项目。 mygame的主要类(活动)是MyGameApp继承自EngineApp(我的发动机项目的主要活动),它继承自Activity。

Problem is that I have no idea how to correctly do this. I created android project called engine with all basic stuff that I need and made it work on device. Now I tried to create another project in same workspace called mygame. Main class (activity) of mygame is MyGameApp which inherits from EngineApp (main activity of my engine project) which inherits from Activity.

我添加发动机项目到在性能mygame构建路径选项卡所需的项目。问题是,当我尝试运行这个项目它崩溃的ClassNotFoundException异常试图找到我的MyGameApp类。

I added engine project into required projects in mygame build path tab in properties. Problem is that when I try to run this project it crashes on ClassNotFoundException trying to find my MyGameApp class.

任何帮助(或指向一些文章,解释如何做到这一点),大大AP preciated。几个小时的谷歌搜索没有多大帮助:/

Any help (or pointer to some articles that explain how this is done) is greatly appreciated. few hours of googling didn't help much :/

推荐答案

您需要设置一个的 Android的项目

You need to set up an Android Library Project

这是安卓的库项目的是,持有共享Android源$ C ​​$ c和资源开发项目。其他Android应用项目可以引用该库项目,并在生成时,在其 .apk文件文件的编译的源代码。多个应用项目可以引用同一个库项目,任何一个应用项目可以引用多个库项目。

An Android library project is a development project that holds shared Android source code and resources. Other Android application projects can reference the library project and, at build time, include its compiled sources in their .apk files. Multiple application projects can reference the same library project and any single application project can reference multiple library projects.

该文档继续说如何将现有的项目转换到库项目中:

The docs go on to say how to convert an existing project to a library project:

您也可以将现有的应用程序项目转换到库中。要做到这一点,只需打开项目属性,然后选择是库复选框。其他应用项目,现在可以参考现有的项目作为库项目。

You can also convert an existing application project into a library. To do so, simply open the Properties for the project and select the "is Library" checkbox. Other application projects can now reference the existing project as a library project.

这篇关于在Eclipse中多依赖机器人项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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