Skip to content

Building for Android

Mariusz Nowostawski edited this page Mar 28, 2014 · 4 revisions

Prerequisites

  • Download and unpack SDL

  • Download and unpack Android NDK

  • Download and unpack Android SDK

  • Note: code tested with NDK r9d and SDK 20140321

  • Install ant

  • After all of the above, setup the PATH environmental variables correctly, so that these commands work in your shell:

    • ndk-build
    • adb
    • ant
  • Go to Android folder in sdl_simple, and copy, or make a symbolic link to SDL so that it looks like that:

sdl_simple/Android/jni/SDL

  • Compile all C/C++ code, by running ndk-build. This should compile all native code and generate the binary version of the SDL2 and the ball code.
$ cd sdl_simple/Android
$ ndk-build
  • Compile all the Java code by running ant debug. This will build the Java stub and link the app with SDL2 and the ball example. This generates the .apk
$ adb debug
  • Install the .apk onto the device by connecting your device via USB and running:
$ adb debug install
Clone this wiki locally