How to get AndEngine GLES2 working with AIDE

348 views
Skip to first unread message

imbet...@gmail.com

unread,
Jan 3, 2014, 2:11:27 AM1/3/14
to andro...@googlegroups.com
Hey guys. First post. After plenty of tinkering and seeing all of the build issues that AndEngine has with AIDE, I decided that I'd figure it out and make it work. Here's the guide.
  1. Compile a jar of AndEngine (see attached).
    1. Clone the AndEngine git project into eclipse and get it all set up (build with java 1.6, as a library, etc)
    2. Once finished, right-click the AndEngine project and select "Export..."
    3. Export the jar to somewhere and name it accordingly (I chose andengine_gles2.jar)
  2. Create a project in AIDE
    1. Basically just open up AIDE and make a new project
  3. Move the jar of AndEngine into the "libs" folder of your project.
  4. That should be it! From the AIDE menu, you may want to select "More", then "Refresh Code Analysis"

Here's some code to test out...

//package com.examplecompany.exampleapp;

import org.andengine.engine.options.EngineOptions;
import org.andengine.entity.scene.Scene;
import org.andengine.ui.activity.SimpleBaseGameActivity;
import org.andengine.engine.camera.Camera;
import org.andengine.entity.scene.background.Background;
import org.andengine.engine.options.ScreenOrientation;
import org.andengine.engine.options.resolutionpolicy.FillResolutionPolicy;
import android.app.*;
import android.os.*;
import android.view.*;
import android.widget.*;

public class MainActivity extends SimpleBaseGameActivity
{
    private Camera camera;
    private static final int CAMERA_WIDTH = 800;
    private static final int CAMERA_HEIGHT = 480;
   
    @Override
    public EngineOptions onCreateEngineOptions() {
        camera = new Camera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);
        EngineOptions engineOptions = new EngineOptions(true, ScreenOrientation.LANDSCAPE_FIXED, new FillResolutionPolicy(), camera);
        return engineOptions;
    }
   
    @Override
    protected void onCreateResources() {
       
    }
   
    @Override
    public Scene onCreateScene() {
        Scene scene = new Scene();
        scene.setBackground(new Background(0.09804f, 0.6274f, 0.8784f));
        return scene;
    }
}

The reason this works is because you're using a pre-compiled/packaged jar of AndEngine, and it just seems to work better with AIDE. The only issue with this is that it's much more difficult to update the jar (as opposed to just pulling from git again), but for app development on the go, this should be perfectly fine for most people to use the static jar.

If you run into issues while compiling the jar, try giving mine a shot. Just download it from the attachments.

If you guys have any issues, post them here and I'll try to address them.

andengine_gles2[1].jar

ste...@familie-mayrhofer.net

unread,
Jan 29, 2014, 9:22:41 AM1/29/14
to andro...@googlegroups.com, imbet...@gmail.com
Thanks for the great guide. But I have one big problem: When I build this sample code (or a "Hello World" app I found in another tutorial) the created apk file is about 2 GB big (when I run or export the app it takes about half an hour to build and gives me a huge apk file).
Do you have a (Hello World or something simple) project where everything is working? If yes, could you share it wth me/the community?

FredT4

unread,
Feb 1, 2014, 3:16:47 AM2/1/14
to andro...@googlegroups.com
Go to JavaIDEandroid website there's two hello would projects there.
Reply all
Reply to author
Forward
0 new messages