Building Games For Android¶
In this chapter we will learn about Building RingLibSDL Games for Mobile.
So we can create packages (*.apk) for the applications that are developed using Ring Game Engine for 2D Games.
Download Requirements and Update the Android SDK¶
The Android SDK Tools
The Android NDK (Tested using android-ndk-r10c)
Apache Ant v1.8 or later
Java SE Development Kit (JDK) v6 or later
Update the Android SDK to get the API and tools packages required for development
Tested using Android 4.4.2 (API 19)
In Windows - Define the next Environment Variables based on your system.
- JAVA_HOME
For Example : C:\Program Files (x86)\Java\jdk1.8.0_05
- ANDROID_HOME
For Example : B:\mahmoud\Tools\Java-Android\adt-bundle-windows-x86-20140702\sdk
Project Folder¶
Open the project folder : ring/android/ringlibsdl/project
You can add the source code (*.ring) and Images/Sound Files to the assets folder.
You will find the Flappy Bird 3000 Game ready for building.
The execution starts from the start.ring file
load "game2.ring"
Building the project¶
Move to the ring/android/ringlibsdl/project folder
We can build using the next command (We need to do this for one time only).
ndk-build
Then we can create the package (*.apk) using the next command.
ant debug
We can write a batch file for building the project (file: build.bat)
rem You will need to modify this batch file based on your environment
set JAVA_HOME=C:\Program Files (x86)\Java\jdk1.8.0_05
set ANDROID_HOME=B:\mahmoud\Tools\JavaAndroid\adt-bundle-windows-x86-20140702\sdk
set NDK_ROOT=B:\mahmoud\Tools\JavaAndroid\android-ndk-r10c
set path=%path%;B:\mahmoud\Tools\JavaAndroid\android-ndk-r10c
set path=%path%;B:\mahmoud\Tools\JavaAndroid\apache-ant-1.9.4\bin
ndk-build