Porting a game to Android
Ian Lewis

Hello,

I've made a game using Allegro 5 (it's here if anyone's interested https://github.com/IanLewis42/GravStorm )

I originally wrote it on/for Raspberry Pi, then did a Windows port. I'd now like to do an Android port.

I've never built anything for Android before, so I have a few 'before you start' type questions.

Most of the allegro-on-android docs suggest using Linux. I'm not terribly familiar with Linux, and don't have a linux box available (other than the Raspberry Pi).

Q1: Is it possible to develop an Allegro 5 android app under Windows? Has anyone actually done it? Any advice / suggestions / tutorials?

Q2: Alternatively, could I use a 'live' distribution of linux (i.e. boot from CD/DVD/USB)? Again, has anyone done this, and if so, what distribution would you recommend?

Q3: Final (least favoured) alternative, is it feasible to do this on Raspberry Pi? It's running Raspbian, based on Debian, but as an original RPi model B, it's a bit underpowered and I can't imagine that installing the toolchain on it is going to be straightforward. Again, has anyone done this?

Q4: (general) Any tips / gotchas for first-time android building?

Cheers,

Ian.

Elias

Q1: I have no idea, but see Q4.

Q2: Yes, but expect about 10GB worth of android stuff (SDK + NDK) to install into that Linux. Also, you will need at least 8GB of ram to run the android compiler or it will just throw an OutOfMemory exception.

Q3: No, it won't have enough ram (and it would take you 10 hours to compile a simple game).

Q4: There is a binary distribution of Allegro for Android: https://github.com/liballeg/android - it should work in Windows and OSX. I haven't figured out a good way to add the .so files in a non-race-condition way so Step 3 may need the mentioned workaround, but otherwise this is how I compile my Android game.

Ian Lewis

Thanks for that.

So it sounds like live linux is difficult. Does that 8GB apply to any OS? Or was it specific to live linux, or to building Allegro?

RPi is out.

I had found the instructions you linked, but I didn't quite understand what they were for. I'm not sure this will work, but I think what I'll try is this:

- Work under Windows
- Install Android studio (includes the SDK, from what I can tell)
- Install the Android NDK
- Install CMake (this might all come with Android studio, if you tick the right boxes)
- Follow the instructions you linked ( https://github.com/liballeg/android )
- Try to build a noddy C/Allegro app.
- Cross my fingers ;D

I'll post how I get on. If anyone sees anything I've missed (or can tell me why this won't work), please say so :-)

Cheers,

Ian.

Elias

If you install Android Studio you don't need to install anything else, so:

  • Install Android Studio

  • Follow those instructions

Should be all you need.

The 8GB apply to any OS, yes. Actually Google claims 3GB may work:

https://developer.android.com/studio/index.html

But in my experience in newer versions of the SDK some things will just fail with that.

Ian Lewis

OK, Thanks. I only have 4GB (I think) so we'll see......

Thomas Fjellstrom

You will want to upgrade your memory if you plan on doing development in general. I found myself running out of memory with 16GB ram, but then I don't like closing things out if I don't have to ;D.

James Lohr
Elias said:

Also, you will need at least 8GB of ram to run the android compiler or it will just throw an OutOfMemory exception.

I developed Samurai Saga (shameless plug!) from scratch on a machine I built back in 2009 which has only 6GB of RAM. Memory was never an issue, even with Android Studio, Gimp, Audacity and 50+ chrome tabs open. Mind you, this was on Windows 7.

video

running out of memory with 16GB ram

People complain about this at work too. I really don't get it. You must have a memory leak or like 50000 chrome tabs open. :P

Thomas Fjellstrom

I can't deny i usually have a lot of chome tabs open, but the projects tend to be large, and i have other apps open that eat ram, etc. Doing a full rebuild of some of them with the internal gradle+javac in android studio can sometimes eat a lot of ram.

Ian Lewis

'I developed Samurai Saga (shameless plug!) from scratch on a machine I built back in 2009 which has only 6GB of RAM. Memory was never an issue, even with Android Studio, Gimp, Audacity and 50+ chrome tabs open. Mind you, this was on Windows 7.'

That's interesting. My tentative conclusion, after a couple of evenings effort, was that (the current version of) android studio doesn't really like 32-bit windows, and specifically that their (modified?) version of CMake doesn't support 32-bit windows at all. I have 32 bit windows 7.....

Did you have 32-bit or 64-bit Windows 7? Did you use CMake?

Regarding memory, I have never had issues with 4GB, but then I mostly work on embedded systems, with relatively small memory footprints...

Cheers,

Ian.

Thread #616695. Printed from Allegro.cc