-
Notifications
You must be signed in to change notification settings - Fork 4
Building for Android
Tommaso Checchi edited this page Jul 9, 2014
·
1 revision
Setup ANDROID SDK/NDK
First, make sure that you have all the packages (yeah they're a lot) required to build with the NDK:
- java http://www.oracle.com/technetwork/java/javase/downloads/index.html
- android http://developer.android.com/sdk/index.html
- android http://developer.android.com/tools/sdk/ndk/index.html
- http://ant.apache.org/
- http://www.cygwin.com/ (In windows)
- gcc (In linux/mac os x)
- clone or download https://bitbucket.org/GabSC/dojo2android
- Download the appropriate https://bitbucket.org/tommo89/dojo/downloads, and unzip them in the dojo folder so they're placed like dojo/dependencies-android
- Open your system's shell (bash or cmd) and cd to dojo/android
- now, just start the build using the command ndk-build (remember to add its folder to the PATH, on windows!)
- libdojo-android.a will pop into dojo/Android/obj/local/armeabi, ready to be used!
On Android, there are many options to build your game with NDK, be it plain makefiles, Eclipse, etc. You can use the tool you're most confortable with, just remember to:
- add dojo/include and dojo/dependencies-android/include to your included headers
- add dojo/dependencies-android/lib to your library path
- link to the libs found in the folder above, plus dojo/Android/obj/local/armeabi/libdojo-android.a (obviously)
If you want to take a shortcut, the dojo repo includes a sample Android project in dojo/samples/ninja-android, ready to be customized to your needs!
Just remember to:
- open dojo/samples/ninja-android/jni/Android.mk" and change the DOJO_PATH variable to your dojo path
- change your game name, "LOCAL_MODULE"
Now, Enable "Debug Mode" in your android device and connect it to your pc, or fire up your emulator.
Then, install and launch the game using
- on windows android.bat update project -p . -s --target android-10
- on windows ant.bat debug install
- on linux/mac os x android update project -p . -s --target android-10
- on linux/mac os x ant debug install
Then, when you get it up and running, go to the next tutorial,
Placing a ninja on screen, from scratch!