Building Android NDK projects with Gradle and Travis CI

I’ve migrated all of my Android projects over to Gradle now as that seems to be the direction that Android development is taking, but if you use the Android NDK in your projects then you’ll discover that NDK support is severely lacking in Gradle. There’s undocumented support for the NDK which can be found if you dive into the samples, but it doesn’t look to be too developed at the moment. Until there’s an official solution for this, I’ve taken my own approach to this, inspired by countless StackOverflow questions and answers.

I also use Gradle in combination with GitHub and Travis CI in order to build and test the latest commits automatically, so I’ll share the .travis.yml build script that I use to do this.

This may not be the best way of doing this, and it will probably be made obsolete when an official solution is documented. However, it works for me. If you know of a better solution then please leave a comment.


Running Theme Hospital on Android with CorsixTH

I’ve used the Android SDK for a few bits and pieces, but I’ve never tried to work with the Android NDK before. So, as an attempt to try to find my way around it, I set myself the goal of porting one of my favourite games – Theme Hospital – to the Android platform in the form of CorsixTH.

I’ve followed CorsixTH for a while, and they’ve made superb progress in recreating a Theme Hospital clone using the original assets from the game. There’s still a fairly extensive list of features in the original game that haven’t yet found their way into CorsixTH, but a large amount of the core game functionality is there.

CorsixTH has a great choice of open source libraries powering it, which actually made compiling it for Android surprisingly easy. In fact, SDL and some libraries that commonly accompany it have already been ported over with great success which really meant that all I had to do was rename a few functions and create a few makefiles to get it running; I’m sure that someone with experience with the NDK could do it in half the time it took me.

In any case, you can get the source code from my GitHub repository and there’s a link to the APK in the downloads section so that you can install it straight to your Android device without compiling the project yourself. I would happily invite anyone to fork the repository and make some improvements as there’s still a fair bit left to do, such as getting it to scale on different device resolutions and scrolling by dragging.



Download App

Download “CorsixTH for Android” CTH-release- – Downloaded 24358 times – 12 MB

Edit: Now also available on Google Play Store!