100 comments on “Setting up AndEngine GLES2.0

    • Nice game , for some reason I couldn’t login to openfient with it though
      I’m glad someone actually made something with my tutorials XD
      you made my day sir

      • glad you like it.

        Weird the open feint stuff.

        Im gonna check if something is wrong with the implementation of their API

        Diego Vargas G

      • Well, I found a problem mixing openfeint + proguard, Im doing a research trying to find the best solution to solve this kind of issues.
        It could be a great topic for your blog, once i get the correct solution of this, ill let you know and maybe you could write a great article about it.

    • Good game, dude. I have played and rated with 5 stars.
      And i hit the advertisements too. πŸ˜‰

    • Good game, dude. I have played and rated with 5 stars.
      And i hit the advertisements too.

      • Thanks bro, with this kind of support you encourage me to keep my hard work, thanks again.

  1. Diego i have noticed a little bug when i hit the same troll several times.
    Sometimes, when this happen, i lose points. Just trying help. πŸ˜‰ And i loved the game.
    I waiting launch my on in the future.

    • Hi!!
      is this happening with dad troll?

      Dad troll is a special kind of target, that only can be punched 1 time, and also, how it is a bonus target you cant touch it only if it completly stops its bounce.

      Im working hardly in make the game 100% compatible with xlarge screens and also Im trying to improve the “how to play” section in order to make clear this kind of cases.

      Thanks for your support! Hope to see your game soon.

      • Not to sound rude , but could you guys use email for bug reports instead of chatting on my blog ? πŸ˜›

  2. Hi Jimmar, i was just following your tutorial and got stock in 1 step. sorry for this dumb question, but i really need you help. it’s on this part

    “Eclipse Git addon is required too [at least for this tutorial]
    you can get EGit by adding this resource to your eclipse resources


    –i don’t know how to get EGit — “how to add this to eclipse resources???”
    when i visited the site http://download.eclipse.org/egit/updates, everything were just codes or should i say java? my main question – what i must suppose to do with it to add it on eclipse?

    well, it’s so obvious that i am a beginner at eclipse.

    * well just for the info, just finish hello android tutorial [androidSDK, eclipse] and all are ok.
    thanks in advance Jim! πŸ™‚

      • Thank you Jim for that fast reply! πŸ™‚ i really appreciate it! sorry if i’m really noob with this.

        On the part of your tutorial

        “create a new class and make it extends SimpleBaseGameActivity ”

        ~~ where should i do this? because i am getting a lot of errors when i tried pasting the codes to mine. or might did it wrong. i pasted it on the

        ~[on ECLIPSE] “under Project I created – under “src” folder – under test.andengine.mine [package name] – then the source code (i hope ur following it πŸ™‚ )– which has default codes as this

        package test.andengine.mine;

        import android.app.Activity;
        import android.os.Bundle;

        public class MY_lAndengineActivity extends Activity {
        /** Called when the activity is first created. */
        public void onCreate(Bundle savedInstanceState) {


        my question is, should i paste it here? because i tried that noob move and got all errors. 😦 sorry again. this is embarrassing me actually but it’s ok as long as i’ll learn. please extend your patience with me.

        and just for the info– also tried adding

        import org.andengine.ui.activity.SimpleBaseGameActivity;

        -resolved 1 error but there’s more. so i might be at the wrong place/ doing the wrong thing.

        Again, just want to thank you in advance! More Power and stay bless! πŸ™‚

      • Here’s what you have to do, delete this class you have that’s called “MY_lAndengineActivity”, then right click on the package “test.andengine.mine” and new -> class , name this class “BaseActivity” [or whatever you want] and on the same page [don’t click ok yet] there is a field to tell it what to extend, there type “SimpleBaseGameActivity” [or you can type Simple and then press ctrl+space to auto complete] and click ok , you should get the proper class.
        One last thing, go to the AndroidManifest.xml and go to xml view, you should see it saying “MY_lAndengineActivity” somewhere , change that to the name of the current activity [BaseActivity or whatever you named it].
        That should fix everything for you.

        I suggest you program a li’l bit more in java before starting game programming so you get familiar with the language and the tools you using

  3. Hi,
    I’ve tried following this tutorial, I’ve tried copying the code by hand and copy and paste, however when I run it it force closes instantly (on a physical phone), no errors in the code.
    I get this from logcat

    05-26 14:23:21.876: D/AndroidRuntime(25427): Shutting down VM
    05-26 14:23:21.876: W/dalvikvm(25427): threadid=1: thread exiting with uncaught exception (group=0x4001d560)
    05-26 14:23:21.886: E/AndroidRuntime(25427): FATAL EXCEPTION: main
    05-26 14:23:21.886: E/AndroidRuntime(25427): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{org.basictest.andengine/org.basictest.andengine.TestAndEngineActivity}: java.lang.ClassNotFoundException: org.basictest.andengine.TestAndEngineActivity in loader dalvik.system.PathClassLoader[/data/app/org.basictest.andengine-1.apk]
    05-26 14:23:21.886: E/AndroidRuntime(25427): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1569)
    05-26 14:23:21.886: E/AndroidRuntime(25427): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
    05-26 14:23:21.886: E/AndroidRuntime(25427): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
    05-26 14:23:21.886: E/AndroidRuntime(25427): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
    05-26 14:23:21.886: E/AndroidRuntime(25427): at android.os.Handler.dispatchMessage(Handler.java:99)
    05-26 14:23:21.886: E/AndroidRuntime(25427): at android.os.Looper.loop(Looper.java:130)
    05-26 14:23:21.886: E/AndroidRuntime(25427): at android.app.ActivityThread.main(ActivityThread.java:3683)
    05-26 14:23:21.886: E/AndroidRuntime(25427): at java.lang.reflect.Method.invokeNative(Native Method)
    05-26 14:23:21.886: E/AndroidRuntime(25427): at java.lang.reflect.Method.invoke(Method.java:507)
    05-26 14:23:21.886: E/AndroidRuntime(25427): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:861)
    05-26 14:23:21.886: E/AndroidRuntime(25427): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:619)
    05-26 14:23:21.886: E/AndroidRuntime(25427): at dalvik.system.NativeStart.main(Native Method)
    05-26 14:23:21.886: E/AndroidRuntime(25427): Caused by: java.lang.ClassNotFoundException: org.basictest.andengine.TestAndEngineActivity in loader dalvik.system.PathClassLoader[/data/app/org.basictest.andengine-1.apk]
    05-26 14:23:21.886: E/AndroidRuntime(25427): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
    05-26 14:23:21.886: E/AndroidRuntime(25427): at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
    05-26 14:23:21.886: E/AndroidRuntime(25427): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
    05-26 14:23:21.886: E/AndroidRuntime(25427): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
    05-26 14:23:21.886: E/AndroidRuntime(25427): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1561)
    05-26 14:23:21.886: E/AndroidRuntime(25427): … 11 more

    Could this be because I’m using the newest andengine?

    Any help would be appreciated?

    • you probably changed the name of the class [the main activity] and didn’t change it in the manifest, open your AndroidManifest.xml and go to xml view then look for “TestAndEngineActivity” and replace it with whatever you named your Activity

      • Im having the same problem I’ve tried everything I can think of 30 times. I had everything working then changed my workspace and started over and cant create a new test project from scratch without this error. I had your invader example working as well as my follow along project which those too have this same error.

        this is the error i always get. This was from a new “test” android app
        01-08 13:19:33.182: E/AndroidRuntime(538): FATAL EXCEPTION: main
        01-08 13:19:33.182: E/AndroidRuntime(538): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.test/com.example.test.MainActivity}: java.lang.ClassNotFoundException: com.example.test.MainActivity

        Strange thing is, and it may be an eclipse bug, but when I right click the project > properties > android and under the library andengine wont be there but there are not compile errors. I then click add and double click andengine and see the green checkbox. I try to run the test and then checkback and theres a red X like its a broken link.

  4. So I have this problem after installing AndEndgine, I didn’t create a res folder anymore because it already had and already chose Android 4.0 then ticked everything and ticked islibrary. It still had an error so what I did is change the AndEngine’s compliance level to 1.6 the error disappeared and this warnings appeared

    The import org.andengine.entity.IEntity is never used LevelLoader.java /AndEngine/src/org/andengine/util/level line 12 Java Problem
    The import org.andengine.util.adt.queue.UniqueQueue is never used AStarPathFinder.java /AndEngine/src/org/andengine/util/algorithm/path/astar line 7 Java Problem
    The import org.xml.sax.Attributes is never used LevelLoader.java /AndEngine/src/org/andengine/util/level line 15 Java Problem

    Then I followed what you said on Efrille Joy’s Comment and Copied Paste your code on the top here is the error that I encountered

    SimpleBaseGameActivity cannot be resolved to a type BaseActivity.java /sample/src/my/sample line 5 Java Problem
    The import SimpleBaseGameActivity cannot be resolved BaseActivity.java /sample/src/my/sample line 3 Java Problem

    So yeah that all about it. πŸ˜€ And also thanks for the tutorial.

    • GLES2.0 NEEDS to use android 2.2+ , so you can’t chose 1.6 at all !
      You need to switch back to android 4.0 and tell me what error you are getting from that

    • oh .. my bad
      try to not copy and paste the code , write it and see what happens
      use ctrl+space for autocomplete [type part of the command then ctrl+space] and auto import stuff

      • I think it’s your imports [I can’t view your imports from the image] try removing all imports then press ctrl+shift+o to auto import and make sure you chose the proper ones [the camera should be the one from andEngine not form android]
        If you still have problems , paste your code on pastebin.com and put a link here [DON’T PUT YOUR WHOLE CODE HERE]
        I don’t really have any recommended tutorials, just start working on something and use google when you need to know specific things, you can also ask questions at stackoverflow.com if you can’t find an answer

  5. Thanks! That fixed it the auto imports. It’s all green here now. No errors. I’m moving on to your space invaders clone tutorial. πŸ˜€

  6. So I reinstalled andengine, I did the same thing that I did to fix it when I first installed it but then this error came “HONEYCOMB cannot be resolved or is not a field”. What I did was to change it to Android 4.0 the error disappeared. But whenever I changed it to Android 2.2 the same error occur.

  7. Hi, I follow your tutorial and when I compile the project (new project), it produces jar file in bin folder instead of apk file, and it won’t run…

  8. Hey bro, Please help :(. I followed steps described above but I am getting error when doing this ” Right click on the project you just created and go to properties, go to Android and click on the add button down in the Library section and chose AndEngine” it just happen fine and green tick appears. but as soon as i click on ok, and come again on properties->Android there is cross on added AndEngine library project. I removed the reference and added project manually through build path, but when I run the application I got class not found exception and on Console I got this Output.

    Output = ” Uploading HelloAnd.apk onto device ‘0146A14F0F01900A’
    [2012-07-06 11:45:21 – HelloAnd] Installing HelloAnd.apk…
    [2012-07-06 11:45:25 – HelloAnd] Success!
    [2012-07-06 11:45:26 – AndEngine] Could not find AndEngine.apk!
    [2012-07-06 11:45:26 – HelloAnd] Starting activity com.example.helloand.MainActivity on device 0146A14F0F01900A “

  9. I found the solution… when importing checked make copy of into worksapce. And all things worked. thanks.

  10. I am a beginer of and engine i hav one doubt wat purpose we use”return new EngineOptions” plz clarify my doubt

    • In GLES2.0 , you need to return an EngineOptions object to be used with the Engine in the onCreateEngineOptions() method
      I’m not sure what your doubts are

  11. Awsome guide, was easy to follow however i am receiving a strange error in the following line
    Camera mCamera = new Camera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);
    “The constructor Camera(int, int, int, int) is undefined”
    and similar error for next line
    any solutions … have i done something really stupid ???

  12. hi sir,,,i have done copy and passte of above code ,and tested on my system,bt after runnig i got error that is unfortunately sh6 has stoped,here sh6 is my project name i have followed all above procedure,also made changes in manifest file according to ur tutorial,what can i do for this problem?

    • Those info are not enough , you should check what the logCat says [in eclipse]
      but are you sure that you included the Activity name in the manifest ?

  13. Hey, when I run my Android App, it says “Android Library Projects cannot be launched.” so any idea what to do.

  14. 08-19 04:07:39.985: W/dalvikvm(19030): Unable to resolve superclass of Lph/serverkid/pokemon/GameActivity; (70)

    public class GameActivity extends SimpleBaseGameActivity {


    i can’t seem to fix this one.

    • Are you sure that you have the library linked properly ?
      try typing
      “extends SimpleBa” then press ctrl+space for intellisence [auto complete] to work and see if it finds if , if it doesn’t then it’s not set up properly

      • i still didn’t know what caused it, i recreated the class file, then copied each part one by one and, it just worked. thank you again for your time writing this blog. πŸ™‚

  15. hey i followed all the steps mentioned in ur post but i get this error…. its seems like its missing this package “org.andengine.BuildConfig” … looking forward to ur solution πŸ™‚

  16. I humbly thank you man. The AndEngine getting started tutorials are from 2010 and I couldn’t manage to setup the library properly. Your tutorial made it incredibly simple to set up everything. πŸ˜€

    Again, thanks a bunch!

  17. Hi im experiencing the same error as Jake.

    10-15 21:22:08.533: E/AndroidRuntime(14402): FATAL EXCEPTION: main
    10-15 21:22:08.533: E/AndroidRuntime(14402): java.lang.RuntimeException:
    Unable to instantiate activity ComponentInfo{lsc.al.testgame1/lsc.al.testgame1.MainActivity}: java.lang.ClassNotFoundException: lsc.al.testgame1.MainActivity

    My activity runs fine when i use ‘extends Activity’ but as soon i use ‘extends SimpleBaseGameActivity’ it gives the error described above


    • This usually happens when the Activity name is not included properly in the manifest .. but it shouldn’t work when you make it extend activity too ..
      are you sure you didn’t edit the activity name form MainActivity ?

      try restarting eclipse , that works sometimes

  18. Hey bro,
    how r u?

    I am already Using GLES1 in my project. Now want to transfer it to GLES2. What should be done by me? I can’t use the new feature of GLES2 like ButtonSprite.

    Thanks in advance.

    • Just install GLES2.0 and apply it to your project [remove the jar file for GLES1]
      you’ll get bunch of errors , with the help of eclipse it’ll be easy to convert your code

      you can also read my Jimvaders tutorial so you notice the differences between them

  19. in this portion of this tutorial
    Getting GLES2.0:

    go to file->import->Git->Projects from Git -> URI
    i didn’t find the Git option. I use Eclipse Juno.

    somebody give me sunshine .

  20. ohh..finally i successfully install gls2.0.
    problem is: Eclipse take sometime to download & install the Egit. after taking sometime Eclipse say it needs restart to take effect. After restarting it works as jimmers write above.

    thanks jimmers a lot.

  21. Hey man, great tut.
    but there is a problem for me… : ss
    I have eclipse sdk, android 2.2 and 4.0 installed done with the Git Addon in help > install new software, I imported the URI and eclipse has created a new project call AndEngine it has an icon with a ‘!’ . Then, I created an other project (xy) and set it up to the settings. (properties > android, again and java path..) everything worked but when i click on the xy test and creat a new ‘class’ (it goes to the xy > src > com.example.xy) and copy the code above it does not work!

    it needs to create new class or import/prepare .graph or anything else..

    I shoudl creat all the classes where it says f. e. “Creat class ‘SimpleBaseGameActivity’ ” ?

    Thanks to you!

    • Right click on the andengine project , Android tools -> fix something something , that should take off the “!” symbol from the AndEngine project
      also you can actually view the error on the errors tab , see what’s the exact problem if it didn’t go away yet [restart eclipse too]
      tell me if that didn’t work

  22. After delete and repeat everthing when i successfully creat the AndEngine project it has the same ‘!’ and the error is the following:

    [2012-11-25 01:21:16 – AndEngine] Unable to resolve target ‘android-15’

  23. Now API 15 installed but there is a newer error. It’s “Android requires compiler compliance level 5.0 or 6.0. Found ‘1.4’ instead. Please use Android Tools > Fix Project Properties.”

  24. Now got it. One & last problem..

    I’ve done with importing the org.* and also android.* files but the Camera mCamera does not work.
    Eclipse asks me to remove mCamera to Camera() but if I do that then nothing happens.

    NOTE: under the Camera mCamera commandline that line is also has error(s).

    here is the image: http://i49.tinypic.com/j0fxqu.jpg

    • You’ve probably imported the wrong Camera , don’t import org.* and android.* , use ctrl+space[to auto complete] and ctrl+shift+o to have eclipse import the proper packages
      you imported the android camera instead of the andEngine camera
      check your imports , remove android.graphics.camera [or android.hardware.camera] and import org.andengine.engine.camera.Camera instead

  25. Good START!
    I just copied and pasted this class that you created – and I ve got empty green screen!
    What is the next steps to try ? Any links ?

  26. Why there is not “onCreate” function something like below? when I commented this function, the App will not run.
    protected void onCreate(Bundle savedInstanceState) {

    • onCreate() is used by the Activity , but here you are extending SimpleBaseGameActivity so AndEngine handles calling onCreate.
      you don’t need to call it yourself

      • Thanks for your explain, JiMMaR. When creating project, eclipse prompts to create an activity and its layout or not. My understanding for this tutorial is that I don’t need to create one in src folder and layout folder, then I need to create a class extending SimpleBaseGameActivity. Am I right? Do I need to modify manifest file?

      • That’s correct, but you’ll also need to add your activity in the manifest too
        so that’s why I suggest having eclipse create an activity for you , and then you open the class and replace it with my template class to avoid touching the manifest

  27. I feed extremaly stupid because I tryed instaling GLES2 & GLES1 for a few times following both your and other peoples tutorials but still NOTHING works

  28. Hi,
    I’ve everything set up after pasting your code, I’m getting this three errors.
    Would you let me know whats wrong?

    The first errors shows up as the constructor Camera(int, int, int, int) is undefined.
    The second line shows up with ScreenOrientation cannot be resolved to a variable.
    The third line says that RatioResolutionPolicy cannot be resolved to a type.

    Can you please help me.. I’m kind of newbie into Java and Android.

  29. Thank you for your help πŸ™‚ This was really useful! Struggled a bit with GIT (never used it before) since it dod not appear in Eclipse’s import menu. Fixed this by ensuring I install Eclipse EGIT. Also discovered that using mercurial no longer works for AndEngine (unless I did it wrong) so GIT is definitly the way to go.

  30. Hello jimmar i found some errors. Can you help me out. According to your tutorial i ticked android 4.0. Those are below :-

    [2013-04-27 11:21:16 – AndEngine] Android requires compiler compliance level 5.0 or 6.0. Found ‘1.7’ instead. Please use Android Tools > Fix Project Properties.
    [2013-04-27 11:21:26 – AndEngine] Android requires compiler compliance level 5.0 or 6.0. Found ‘1.7’ instead. Please use Android Tools > Fix Project Properties.

    Please help me out. I would be very thankful to you….

  31. Hello,
    I solved the above problem now there is an error. Plz help me out

    Error – The project cannot be built until build path errors are resolved
    Location – unknown
    Type – Java problem

    Plz help me out…….

  32. Getting so much errors when copy and paste the code. What to do ?
    Though it is a silly question, please help me.

  33. I added, Properties>Android>Library>Add Jar>ok , but i am not enable to use SimpleBaseGameActivity, when i check again library it shows red cross on library.
    I am very thankful till this stage of you, but solve my problem.
    Thank you very much.

    • GLES2.0 Doesn’t need any Jar file
      if you follow this tutorial from the beginning you’ll notice that I said we won’t need any jar files
      so you shouldn’t be adding jar files , download the source code from github and add it as a library

  34. Hi, i completly followed you Tutorial, imported the AndEngine Source from GitHub and checked all Settings, but i just can’t find SimpleBaseGameActity. Eclipse throws a warning there.

    Any Idea? Thanks.

    • Got it working now! πŸ™‚ Really helpful and good described Turtorial! Thank you!

      Best regards,


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s