0

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:

  • AndroidFrameWork2D
  • AndroidFrameWork2DImplementation
  • 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. 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?

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. For the exports, I only selected the source folder.

eclipse tree

edit: using dumpstate's answer I get this in the logcat: logcat

another edit: dumpstate's answer worked but it's incredibly slow compared to when I just copied the packages into the project. Is this a byproduct of including them in this manner?

2 Answers 2

1

If AndroidFramework2D and AndroidFramework2DImplementation are ordinary Java projects:

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.

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)

Sign up to request clarification or add additional context in comments.

6 Comments

doing this results in a ClassNotFoundException
In the 'Order and Export' tab of Java Build Path properties, select the projects you depend on to export.
If AndroidFramework2D and AndroidFramework2DImplementation are Android projects, they should be set up as library projects and referenced by Android > Library...: developer.android.com/tools/projects/projects-eclipse.html
see the edited question for the logcat output... the closed package 'snakeGame' just copies these packages into the src folder and works fine.
going into the properties and changing them to library projects didn't help. same error...
|
0

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.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.