简体   繁体   English

在Android项目中使用其他项目

[英]Using other projects in Android project

I'm messing around with this book and can't figure out the proper way to set up the projects. 我在弄乱这本书 ,无法弄清楚设置项目的正确方法。

They tell you to make 3 projects which I've named: 他们告诉您进行3个我命名的项目:

  • AndroidFrameWork2D AndroidFrameWork2D
  • AndroidFrameWork2DImplementation AndroidFrameWork2DImplementation
  • snakeGame2 snakeGame2

To get the snake game to work I've just copied the packages from the other two projects and pasted them into the snakeGame2 project. 为了使蛇游戏正常工作,我只复制了其他两个项目中的软件包并将其粘贴到snakeGame2项目中。 What's the proper way to include these into snakeGame2 so that I don't have multiple copies all over the place and can reuse the projects for a different game? 将这些内容包含到snakeGame2中的正确方法是什么,这样我就不会在各处放置多个副本,并且可以将项目重用于其他游戏?

The pic below shows the tree after trying to export the java source files and resources and then adding the jar to the build path of snakeGame2. 下图显示了尝试导出Java源文件和资源,然后将jar添加到snakeGame2的构建路径后的树。 For the exports, I only selected the source folder. 对于导出,我只选择了源文件夹。

蚀树

edit: using dumpstate's answer I get this in the logcat: 编辑:使用dumpstate的答案我在logcat中得到此: logcat的

another edit: dumpstate's answer worked but it's incredibly slow compared to when I just copied the packages into the project. 另一个编辑:dumpstate的答案有效,但是与我刚将软件包复制到项目中时相比,它的速度令人难以置信。 Is this a byproduct of including them in this manner? 这是以这种方式包括他们的副产品吗?

If AndroidFramework2D and AndroidFramework2DImplementation are ordinary Java projects: 如果AndroidFramework2D和AndroidFramework2DImplementation是普通的Java项目:

Right click on the project > Build Path > Configure Build Path > Java Build Path > 'Projects' tab > Add.. > Choose the project you'd like to depend on. 右键单击项目>构建路径>配置构建路径> Java构建路径>'项目'选项卡>添加。>选择您要依赖的项目。

If AndroidFramework2D and AndroidFramework2DImplementation are Android projects, they should be set as library projects (Configure Build Path > Android > check 'Is library') and the snakeGame project should refer to them (Configure Build Path > Android > Library > Add; decribed here: developer.android.com/tools/projects/projects-eclipse.html) 如果AndroidFramework2D和AndroidFramework2DImplementation是Android项目,则应将它们设置为库项目(配置构建路径> Android>检查“ Is库”),snakeGame项目应引用它们(配置构建路径> Android>库>添加;在此处进行描述: developer.android.com/tools/projects/projects-eclipse.html)

I ended up linking the source folders from the other projects following this page 我最终链接了此页面后其他项目的源文件夹

This method didn't have the slow downs I observed when doing libraries and jars. 在执行库和jar时,这种方法没有我观察到的速度下降。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Maven项目无法与其他项目一起使用 - Maven project not working with other projects 将一个项目作为库链接到其他项目 - Linking a project as a library to other projects Maven项目与Eclipse中其他项目之间的区别 - Difference between maven project and other projects in Eclipse 使用 Maven 部署一个 Spring-Boot 项目,并在其他项目中进一步导入 - Deploying a Spring-Boot project using Maven and further importing it in other projects 如何启动其他Android项目中定义的活动? - How to start an activity that is defined in other Android projects? Android应用程序项目中的依赖库项目的NoClassDefFoundError(使用maven作为构建工具) - NoClassDefFoundError for dependent library projects in Android app project (using maven as build tool) 在 Eclipse 中使用 Gradle 在构建路径中的其他项目 - Using other projects in build path with Gradle in Eclipse Spring项目从其他Spring Project获取数据库配置 - Spring projects get database configuration from other Spring Project 有什么办法可以在tomcat中仅部署一个项目,而将其他项目保留 - Is there any way to deploy only one project in tomcat leaving the other projects 查找其他哪些项目将此项目用作Maven依赖项? - Find what other projects use this project as a maven dependency?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM