开发者

How would you write a library to be used on android?

I've already written a game engine in java using eclipse and opengl es, I had one project (an android project) which contained both of my packages

com.logic.engine
com.logic.testapp

I wanted a way to keep my engine and test app seperate, I've made an earlier post abo开发者_如何学JAVAut how this is done, and I figured out how to reference one project in the build path of another (or just creating a jar file).

My problem is that, lets say I now have my engine all wrapped up in an android project com.logic.engine, and now someone would like to use this engine to create a game, so they create an android project com.someclient.game, well now because we have one android project referencing another, it crashes everytime.

Now obviously i need the android sdk in my engine package in order to reference things, but its also required on the client app, since the activity is what is actually being run by android.

I guess my question is, how can i create a project for my game engine without it being an android project, but still referencing the android sdk, and without causing it to crash the client app using it?

edit:

note: the client app utilizes the engine flawlessly when its in the same project folder, it isn't until the engine is referenced from another project containing the android sdk that it crashes, so im 99.9% positive it has nothing to do with my code


Your game engine project should be an Android library project. See Working with library projects.


Use an Android library project.


Just a fix for the two links above that no longer work

Android Library Project

Example Library Tut

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜