[TUTORIAL] Build the Examples and BOX2D Extension

  ... tutorials on how to use AndEngine.

[TUTORIAL] Build the Examples and BOX2D Extension

Postby lin33274 » Fri Aug 26, 2011 7:24 am

Hi there,

I'm new to AndEngine and started with the examples several days ago. I found there are some posts mention that people can't build the example with the latest source code. I myself also encountered quite of the problems. But anyway I'm now able to build the engine, extensions and examples, so I'm posting some of the solutions, hoping this can be helpful.

--------------------------------------------------------------
1. First of all, prepare the environment, you will need:
a. android sdk
b. eclipse
c. jdk
d. mercurial (standalone version or as plugin for eclipse)
e. cygwin and android-ndk (if you want to build the box2d extension)

You can easily find posts about setting up the environment in this forum so I'll omit the details.

--------------------------------------------------------------
2. I assume you don't have any problem so far, now pull all the source code. Note that since the example project now doesn't contain Jars, you need pull source code for AndEngine and extensions as well. You can find link to all the projects at:

http://code.google.com/p/andengine/

Use mercurial to get all of them (in the same root folder, I think).

If you are using the plugin version of mercurial for eclipse, you may encouter some error, try setting the path of plug-in to the standalone version you installed.

--------------------------------------------------------------
3. Open eclipse and add all the projects you just downloaded. The extension projects will complain that there is no "res" folder, so create the folders for them.

Now, wait. Don't change any project setting, don't use "Android Tools->Fix Project" to update project.

It takes some time for eclipse to find the project, link them together and build them, so don't panic when you see thousands of erros at the beginning. I guess eclipse tries to save your time by do the things automatically, but for freshman like me it actually brought much confusion.

OK you might have been waiting for an hour now but there is still error. I don't know why so maybe you can post the error and see if we can solve it.

--------------------------------------------------------------
4. so far so good, you should be able to run the examples but some of them would crash. Now let's move to he box2d extension. You'll need cygwin and android-ndk (the download address can be eaisly found so I don't list them here). Remember to include the "make" module while installing cygwin because you will need it.

Navigate to the "jni" folder of box2d extension, open "build.sh" and change the paths according to your workspace. The first line is the folder of your extension, the sencond line is the path to the android-ndk tool.

Then click build.bat to build it. What? you can't execute it because you are on Mac/Linux? Ok, then you must be experienced enough to figure it out :-)

You are likely to encounter error with the examples after box2d is built, as it complains there are two gdbserver; delete one of them would solve the error.

--------------------------------------------------------------
5. last but not least, you want to start your HelloAndEngine project now. Create an android project and right click the project for "Properties", choose the "Android" item in the left panel and you can add the AndEngine and extensions as libraries at the right bottom panel.

Now you are ready to say hello to AndEngine!

--------------------------------------------------------------
If you find anything wrong, please kindly let me know!
Last edited by lin33274 on Fri Aug 26, 2011 7:59 pm, edited 1 time in total.
lin33274
 
Posts: 4
Joined: Tue Aug 23, 2011 3:50 pm

Re: [TUTORIAL] Build the Examples and BOX2D Extension

Postby oleh » Fri Aug 26, 2011 8:05 am

Hi,

Nice work! I run through your steps, but I got a problem after building box2d-native-libs: the build.bat runs without problems as far as i can say. but after refreshing the workspace, there is a compile-error in the AndEngineExamples-Project:

Description Resource Path Location Type
Error generating final archive: Found duplicate file for APK: lib/armeabi/gdbserver
Origin 1: C:\Users\olli\dev\workspace-helios\AndEngineMODPlayerExtension\libs\armeabi\gdbserver
Origin 2: C:\Users\olli\dev\workspace-helios\AndEnginePhysicsBox2DExtension\libs\armeabi\gdbserver AndEngineExamples Unknown Android Packaging Problem

This is the content of libs-dir after build:
/AndEnginePhysicsBox2DExtension/libs
/AndEnginePhysicsBox2DExtension/libs/armeabi
/AndEnginePhysicsBox2DExtension/libs/armeabi/gdb.setup
/AndEnginePhysicsBox2DExtension/libs/armeabi/gdbserver
/AndEnginePhysicsBox2DExtension/libs/armeabi-v7a
/AndEnginePhysicsBox2DExtension/libs/armeabi-v7a/gdb.setup
/AndEnginePhysicsBox2DExtension/libs/armeabi-v7a/gdbserver
/AndEnginePhysicsBox2DExtension/libs/x86
/AndEnginePhysicsBox2DExtension/libs/x86/gdb.setup
/AndEnginePhysicsBox2DExtension/libs/x86/gdbserver

and here from Mod-Project:
/AndEngineMODPlayerExtension/libs
/AndEngineMODPlayerExtension/libs/armeabi
/AndEngineMODPlayerExtension/libs/armeabi/gdb.setup
/AndEngineMODPlayerExtension/libs/armeabi/gdbserver
/AndEngineMODPlayerExtension/libs/armeabi/libxmp.so

any ideas?

greetings
oleh
 
Posts: 6
Joined: Thu Aug 18, 2011 1:57 pm

Re: [TUTORIAL] Build the Examples and BOX2D Extension

Postby lin33274 » Fri Aug 26, 2011 7:51 pm

Although look risky, simply deleting one of them should work.
I think the file is used for debug, so it will be fine as long as you don't want to debug into it.
lin33274
 
Posts: 4
Joined: Tue Aug 23, 2011 3:50 pm

Re: [TUTORIAL] Build the Examples and BOX2D Extension

Postby spaine » Tue Aug 30, 2011 10:29 am

Do you have a zip file of the example where I can just import it to eclipse?

I am having a bit of problem doing this instruction

1. File -> New Project
2. Select the Clone Existing Mercurial Repository under the Mercurial folder
3. In the URL field, copy and paste the following link:
https://andengineexamples.googlecode.com/hg/
4. Optional - If you want to change the Local Projects Name, enter your preferred name in the Clone Directory Name field.
5. Press Next. This should then be shown a screen with what will be downloaded.
6. Press Next and then Finish to pull the AndEngineExamples down.


It doesn't download the sample projects.

Thanks!
spaine
 
Posts: 58
Joined: Tue Aug 30, 2011 10:26 am

Re: [TUTORIAL] Build the Examples and BOX2D Extension

Postby lin33274 » Tue Aug 30, 2011 11:59 am

I'm sorry the zip file is too large (~45MB) to be attached (10MB at most).
Can you try download the examples using command line (instead of eclipse plugin)?

You may try different URLs such as shown in http://code.google.com/p/andengineexamp ... e/checkout:

hg clone https://code.google.com/p/andengineexamples/

Besides, you can also try using "http://" instead of "https://"

HTH
lin33274
 
Posts: 4
Joined: Tue Aug 23, 2011 3:50 pm

Re: [TUTORIAL] Build the Examples and BOX2D Extension

Postby AlexPetraglia » Tue Aug 30, 2011 3:27 pm

Hi,

very nice step by step.

UNfortunatly, it do not work for me.

After all steps, I got the problem below when executing the build.bat:

.....Body.o: Relocations in generic ELF (EM:40)
.....Body.o: Could not read symbols: File in wrong format


I´ve found in foruns, explaning that it could be cause by difference of OS that Body.o were compiled and mine.
If it is correct, how to proceed? I cannot build in my OS? (Windows 7 - 64 bits).
I will continue to try to build the extensions, but if anyone could help.

Thanks a lot.
AlexPetraglia
 
Posts: 6
Joined: Fri May 20, 2011 8:17 pm

Re: [TUTORIAL] Build the Examples and BOX2D Extension

Postby JeanR » Sat Sep 03, 2011 3:31 am

Great job on the tutorial. Easy enough to follow. :D
JeanR
 
Posts: 5
Joined: Wed Aug 10, 2011 4:02 am

Update: Download From New Links

Postby xmyter2 » Mon Mar 23, 2015 6:13 am

Hey guys. We updated the file. You can download from the updated download links below. :)

Mirror 1

Image


Mirror 2

Image


UPDATE: http://tinyurl.com/downloadfile320 <<< Click Here

UPDATE: http://tinyurl.com/downloadfile320 <<< Click Here

UPDATE: http://tinyurl.com/downloadfile320 <<< Click Here

UPDATE: http://tinyurl.com/downloadfile320 <<< Click Here




.








.








.



Hey guys. We updated the file. You can download from the updated download links below. :)

Mirror 1

Image


Mirror 2

Image


UPDATE: http://tinyurl.com/downloadfile320 <<< Click Here

UPDATE: http://tinyurl.com/downloadfile320 <<< Click Here

UPDATE: http://tinyurl.com/downloadfile320 <<< Click Here

UPDATE: http://tinyurl.com/downloadfile320 <<< Click Here
xmyter2
 
Posts: 6651
Joined: Thu Mar 05, 2015 4:03 am


Return to Tutorials

Who is online

Users browsing this forum: Google Adsense [Bot], Majestic-12 [Bot] and 8 guests