SDL on Android

Here’s a quick summary of how I got SDL to work on Android. First off, this is my setup:

  • Android NDK r6
  • Android SDK r12
  • SDL-2.0.0-6284

The first piece of bad news is that Android support is only in the upcoming SDL 2.0, not in the current stable 1.2. Although I’m sure it could be backported, SDL2 is pretty similar, so I decided to upgrade. The file does a pretty good job of explaining the steps, but there were a few kinks:

  1. in jni/src/, the line LOCAL_SHARED_LIBRARIES := SDL is wrong. That needs to be SDL2
  2. Java didn’t like that all the classes in src/org/libsdl/app/ are in one file. I had to make separate and files.
  3. In the onTouch method, I get a compile error (cannot find symbol) for event.getActionIndex() and event.getActionMasked(), so I commented out some of that code and haven’t used touch events yet. I still need to crack this nut.
  4. Because my SDK is installed in C:Googleandroid-sdk-windows, I had to edit to say sdk.dir=/Google/android-sdk-windows

Now I have one of the SDL test app running on my phone, drawing rectangles. Time to see if I can do something useful with that!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s