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 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.