Allegro.cc - Online Community

Allegro.cc Forums » Installation, Setup & Configuration » Getting Started With Android?

This thread is locked; no one can reply to it. rss feed Print
Getting Started With Android?
jmasterx
Member #11,410
October 2009

I would like to eventually port my game to Android, but I feel it is tricky to just get the examples running.

I was wondering if anyone has either:
A tutorial from start to finish on getting an example working with all the addons (Image, TTF, PhysFS, OGG, MindControl, etc)

Or possibly, build scripts for addons, template project files, etc.

Trent made something similar for iOS which was very, very useful for me.

I would be willing to send someone $10 via PayPal for some decent build scripts / template project.

Thanks!

Yodhe23
Member #8,726
June 2007

Using Linux thesedays it is comparatively straight forward, tbh.
I can't speak about Windows, as I don't use it for Android Development.

www.justanotherturn.com

jmasterx
Member #11,410
October 2009

I have no objection to using Linux (I use Mac which is *nix-like) But I still am not sure how to build the deps (aside from trivial ones like libpng) and how to get a basic example going.

I got the NDK, setup my toolchain, but build scripts would really help, if you have any advice I'd really appreciate it.

Mark Oates
Member #1,146
March 2001
avatar

I'm kinda on the edge of my seat for the answer to this thread. :)

I'll kick in $10, too ;). PayPal or Bitcoin.

--
Visit CLUBCATT.com for cat shirts, cat mugs, puzzles, art and more <-- coupon code ALLEGRO4LIFE at checkout and get $3 off any order of 3 or more items!

AllegroFlareAllegroFlare DocsAllegroFlare GitHub

Yodhe23
Member #8,726
June 2007

Having been there myself (see https://www.allegro.cc/forums/thread/615363)
The template thats come with Allegro via git are fine to use.

As of the last time I built for android on the 1st June 2015, I could build the following dependencies- (assuming you copied/git'd allegro to $HOME/allegro)

Note
export TC=$HOME/android-toolchain ($TC points to your android-toolchain)

The cross.cmake file that is used is as follows, Note you will have to change the home/yodhe... to match your directories on your system.

#SelectExpand
1# 2# this one is important 3SET(CMAKE_SYSTEM_NAME Linux) 4#this one not so much 5SET(CMAKE_SYSTEM_VERSION 1) 6 7# specify the cross compiler 8SET(CMAKE_C_COMPILER /home/yodhe/android-toolchain/bin/arm-linux-androideabi-gcc) 9SET(CMAKE_CXX_COMPILER /home/yodhe/android-toolchain/bin/arm-linux-androideabi-g++) 10 11# where is the target environment 12SET(CMAKE_FIND_ROOT_PATH /home/yodhe/android-toolchain) 13 14# search for programs in the build host directories 15SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 16# for libraries and headers in the target directories 17SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 18SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 19#

freetype-2.5.5
./configure --host=arm-linux-androideabi --disable-shared --enable-static --prefix=$HOME/allegro/build/deps --without png --without-zlib --without-harfbuzz

physfs-2.0.3 (turn off CD Options in cmake file to build)
cmake .. -DCMAKE_TOOLCHAIN_FILE=cross.cmake
-DCMAKE_INSTALL_PREFIX=$HOME/allegro/build/deps

DUMB-0.9.3
make CC=$TC/bin/arm-linux-androideabi-gcc AR=$TC/bin/arm-linux-androideabi-ar
PREFIX=$HOME/allegro/build/deps CFLAGS="-fPIC -mthumb -Wno-psabi -march=armv7a -mfloat-abi=softfp -I./include"

libogg-1.3.2 (DOESN'T WORK WITH API 19+ tested with Allegro 5.1.10, and previous)
./configure --host=arm-linux-androideabi --disable-shared --enable-static --prefix=$HOME/allegro/build/deps

libvorbis-1.3.5 (As above due to ogg dependency)
./configure --host=arm-linux-androideabi --without-ogg --disable-shared --enable-staic --prefix=$HOME/allegro/build/deps

libtheora-1.1.1 (See ogg issue)
./configure --host=arm-linux-androideabi --without-ogg --without-vorbis --disable-shared --enable-static --prefix=$HOME/allegro/build/deps --disable-examples --disable-float

Now I can't get the following two dependencies to build

Openal-soft-1.16.0 (RUNTIME ERROR lookupUINT function not found in adb log)
cmake.. -DCMAKE_TOOLCHAIN_FILE=cross.cmake
-DCMAKE_INSTALL_PREFIX=$HOME/allegro.build/deps

sudo make LDFLAGS=avoid-version

sudo make LDFLAGS=avoid-version install

Flac-1.3.1 (RUNTIME ERROR)
./configure --prefix=$HOME/allegro/build/deps --host=arm-linux-androideabi --disable-largefile --disable-thorough-tests --disable-doxygen-docs --disable-xmmsplugin --disable-ogg --disable-oggtest --enable-static --disable-shared --disable-cpplibs

If anyone can get Openal or Flac to work I would appreciate how they do it. I would also really appreciate if the "powers that develop" could fix OGG with Android 5+.

(And if people REALLY want to help me/give me cookies, I have an allegro (android) game coming out next month for £2.49 I would really appreciate people buying it a giving an honest review.)

www.justanotherturn.com

jmasterx
Member #11,410
October 2009

Thank you very much, I will be sure to buy your game and review it! It might be in a month though as Ive only just recently ordered Android Tablets.

I had a quick question: that libogg issue, if you compile against < api 19, will the app still have sound on an api19+ device or is the problem only when you initially compile against api19+?

Yodhe23
Member #8,726
June 2007

Ogg won't work with any Android version 5+ that I've tested (5, 5.02, and 5.1.1) and produces a runtime crash. It does work with 4.4.2 and less, but I haven't tested on any device running less than actually 4.0.

www.justanotherturn.com

jmasterx
Member #11,410
October 2009

So if I compile vorbis with --without-ogg ill be alright,the sound will work or 4+?

Yodhe23
Member #8,726
June 2007

Well you have to compile the dependencies "--without-ogg" anyway?
Sound works (.wav/.mp3), it just that when Allegro comes to playback an .ogg file it crashes at runtime (on aOS 5+, which i suspect is to due with the Dalvik change, but I am not sure). Loading the .ogg seems fine afaik.
My notes however are three months old, I merely have an * against the vorbis, and theora dependencies indicating they are seemingly dependent/error prone like libogg, but I don't know for sure. Perhaps you will have more luck than me, or find a suitable workaround, as my knowledge is probably less than stellar.

www.justanotherturn.com

George24
Member #14,359
June 2012

I did get the examples to work and documented this in detail on this Wiki page:

Running_Allegro_applications_on_Android

Go to: