Saturday, June 11, 2011

Off-Topic Article: How to stay up to date in andengine

Getting the sources of AndEngine


First of all we need to get the sources. We need to get the sources of andengine. For that you will need any Mercurial Client.


In my case (debian) "apt-get install mercurial", in ubuntu it may work well. If you use windows, try with the links in the mercurial page. Now we need to create a directory, open a terminal, go to that folder and write this:


hg clone https://andengine.googlecode.com/hg/ andengine

I have an output like this:
requesting all changes
adding changesets
adding manifests
adding file changes
added 818 changesets with 3243 changes to 703 files (+4 heads)
updating to branch default
410 files updated, 0 files merged, 0 files removed, 0 files unresolved


Congratulations, our first step to have our own andengine.jar is completed


Importing sources in android


In the Eclipse menu, we go to File -> Import



We select "Existing Projects into Workspace" and press Next. Now in "Select root directory" we need to browse to the directory when we downloaded the sources of andEngine. In my case looks like that.



If you have done all the steps correctly, in Projects you must see AndEngine checked. Click Finish.



Now we have the project inside Eclipse, but it appears some erors.


Fixing some errors


Once imported the project in Eclipse, you need to create the Res folder. Right Click on AndEngine Root Project and select New -> Folder




Once created the res folder the problems have gone away.


Exporting the jar


Right Click on root AndEngine Project and select export.



We select Java -> Jar file and click Next.



In the next screen we need to do something important, we need to uncheck all the checkboxes in the right part of the screen, i marked in the photo in red. Then you need to put a path to the jar... and click Finish. All done.



Hope it helps you guys.

4 comments:

  1. I'm still getting the res errors after creating the res directory:

    [2011-07-10 17:57:54 - AndEngine] ERROR: resource directory 'C:\\andengine\res' does not exist

    ReplyDelete
  2. Scrap that - I restarted Eclipse and the errors seem to have gone away

    ReplyDelete
  3. Only I want to say that after creation of res folder, I need to click on Properties for AndEngine > Java Build Path > Order and Export > mark Android 1.6 to get delete all error messages and be able to export without errors (only warnings)

    Good job!

    ReplyDelete
  4. Why I can't compile AndEngine for Android 2.2? I tried that and the game example won't run.

    ReplyDelete