Allegro.cc - Online Community

Allegro.cc Forums » Installation, Setup & Configuration » Building Android on Windows

This thread is locked; no one can reply to it. rss feed Print
Building Android on Windows
TrieBr
Member #12,157
July 2010

I started work on a game engine recently and decided to use SDL 2 because I can get it working on Android a lot easier than Allegro. However not far into the project I realized SDL2 is not my cup of tea and I want to use Allegro instead. The problem is that no matter what I do, I can't seem to get Allegro working on android through windows.

SDL2 simply uses an Android.mk file and then you can call ndk-build on the file and it will compile your code and you can open the folder in eclipse to make/run the .apk. The instructions are fairly simple and I can compile an Android apk quite easily.

However with Allegro, the instructions involve make-standalone-toolchain.sh which doesn't work on windows and I've still had endless problems with it on a unix machine and I haven't successfully been able to run an Allegro game on Android.

So I thought maybe if the developers of Allegro could look at the SDL2 Android build technique and use if for Allegro it would make Allegro a more novice friendly library. I'm fairly certain the techniques are quite similar and it wouldn't be too much work to use the Android.mk/ndk-build

Or if there is already an existing technique for building Allegro Android on Windows (without cygwin), any advice would be appreciated

Edgar Reynaldo
Member #8,592
May 2007
avatar

Thomas Fjellstrom
Member #476
June 2000
avatar

TrieBr said:

I'm fairly certain the techniques are quite similar and it wouldn't be too much work to use the Android.mk/ndk-build

It does, for the example project. Using the standalone toolchain makes it easier for you to build your own stuff. but theoretically the standalone toolchain step could be removed.

One reason I picked using the standalone toolchain was allowing allegro's normal cmake setup to be used to build allegro itself. noone wants to maintain more than one build system. it's been tried.

We could also add a new Find*.cmake script that helps us look for the android build tools, rather than depending on the standalone toolchain.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

TrieBr
Member #12,157
July 2010

Yeah, that makes sense to use cmake for all building.

If I managed to get allegro built using the standalone toolchain in Linux, then would I be able to use ndk-build on windows to build my actual game? I'm fairly sure the actual linking to the .so files is done at run time (in SDL anyway) so once allegro is built I should be able to do the rest on Windows?

Thomas Fjellstrom
Member #476
June 2000
avatar

I believe so yes, if you can get allegro built for android, you can just copy the allegro libs into your libs/armeabi* folder. you'll want to copy the include files out of the allegro/build/include folder as well, and point your project at those (you can't just copy out the source include files, some files are generated at build time).

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

TrieBr
Member #12,157
July 2010

So I gave it another shot using Ubuntu on VirtualBox, and I got allegro compiled. :)

So I continued to follow the instructions and I eventually got an APK which I installed and ran on my device. Unfortunately the app crashed and spit out an error on logcat

Couldn't load allegro-debug from loader dalvik.system.PathClassLoader[dexPath=/data/app/org.
liballeg.app-1.apk,libraryPath=/data/app-lib/org.liballeg.app-1]: findLibrary re
turned null

I made a folder called armeabi-v7a in the jni folder (where main.c is) and I put all of the .so files in there (including liballegro-debug.so).

Here is my Android.mk

http://pastebin.com/6s81rzr1

I'm currently just trying to compile the basic android-project that comes with allegro, the only thing I have added to Android.mk is the ANDROID_NDK_TOOLCHAIN_ROOT path.

Any help would be much appreciated

Edit:
I opened up the project in eclipse and debugged it from there instead of using the "android update project" and "ant debug" method and it is working now, but I would still be interested in fixing the other method as well.

Trent Gamblin
Member #261
April 2000
avatar

Did you change the app name from org.liballeg.app anywhere? If so you have to run cmake with -DANDROID_APP_NAME=com.example.gamename.

Go to: