User Tools

Site Tools



Building/working on the Android Port

Note : We recommend you to put the "android-toolchain" and "player" directories in the same directory.

1) Build the android port

a) Install the Android SDK

Download and follow the official instructions to install the Android SDK :

In the SDK directory, execute the "android" file, it displays a GUI. Use it to download the API 12 (or later). If you want to launch the application on a Virtual Machine, download the ARM EABI System Image.

Export the SDK directory's path :

export SDK_ROOT=/the_sdk_directory_path

b) Install the Android NDK

To compile the Player's C++ code for Android, you have to compile it with the Android NDK. Download it and follow the official instructions :

Export the NDK directory's path :

export NDK_ROOT=/the_ndk_directory_path

You also have to export the ARM EABI toolchain path in the NDK directory. On Linux it should be :

export PATH=$NDK_ROOT/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin:$PATH

On MacOS it should be :

export PATH=$NDK_ROOT/toolchains/arm-linux-androideabi-4.8/prebuilt/darwin-x86_64/bin:$PATH

c) Build the Android Toolchain

In your working directory, clone the android-toolchain :

git clone android-toolchain
cd android-toolchain

Execute this script :

# Compile easyrpg dependencies
cp obj/local/armeabi-v7a/*.a libs/armeabi-v7a/
## Compile icu
# Native
cp -r icu4c-53.1 icu4c-53.1-native
cd icu4c-53.1-native/source
chmod u+x configure
./configure --enable-static --enable-shared=no --enable-tests=no --enable-samples=no --enable-dyload=no --enable-tools --with-data-packaging=static
# Android
cd ../../icu4c-53.1/source
export CPPFLAGS="-I$NDK_ROOT/platforms/android-8/arch-arm/usr/include -I$NDK_ROOT/sources/cxx-stl/stlport/stlport -O3 -fno-short-wchar -DU_USING_ICU_NAMESPACE=0 -DU_GNUC_UTF16_STRING=0 -fno-short-enums -nostdlib"
export LDFLAGS="-lc -Wl,-rpath-link=$NDK_ROOT/platforms/android-8/arch-arm/usr/lib/ -L $NDK_ROOT/platforms/android-8/arch-arm/usr/lib/"
chmod u+x configure
./configure --with-cross-build=$ICU_CROSS_BUILD --enable-strict=no  --enable-static --enable-shared=no --enable-tests=no --enable-samples=no --enable-dyload=no --enable-tools=no --host=arm-linux-androideabi --with-data-	packaging=static
mv $NDK_ROOT/platforms/android-8/arch-arm/usr/include/util.h _util.h #To prevent a build error
mv _util.h $NDK_ROOT/platforms/android-8/arch-arm/usr/include/util.h #Back to the original directory
cp lib/*.a $WORKSPACE/libs/armeabi-v7a/

2) Build the Android Port

Return to your working directory (which should contain the android-toolchain directory)

Export the android-toolchain directory, it should be :

export EASYDEV_ANDROID=$(pwd)/android-toolchain

Export the path of the zipalign program in the Android SDK, which depends of the API installed package :

export PATH=$PATH:$SDK_ROOT/build-tools/21.1.2/

Create a keystore which will be used later :

keytool -genkey -v -keystore easyrpg.keystore -alias nightly -keyalg RSA -keysize 2048 -validity 10000

Export the path of the generated keystore.

export PATH_KEYSTORE=$(pwd)/easyrpg.keystore

And the password you gave when you generated the keystore :

export MDP=the_password

Clone the Player repository :

git clone
cd Player

Then execute this script :

#Clone of liblcf
mkdir -p lib
git clone lib/liblcf
cd builds/android
#Download of timidity
git clone assets/timidity

You have to specify the API Target you will use to build the Player, for now we use the API 12, use "android list targets" to know the number associated with installed API. We assume this number is 1 :

android update project --path "." --target 1

NB : We're targeting API 12 (to have gamepad support from SDL lib), but the minimum supported SDK is API 10.

Build the project :

ant clean
ant release
cd bin
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore $PATH_KEYSTORE -storepass $MDP SDLActivity-release-unsigned.apk nightly
zipalign 4 SDLActivity-release-unsigned.apk EasyRpgPlayerActivity.apk

3) Import the project on Eclipse

a) Install the ADT Plugin

Follow the official instructions by Google : Don't forget to specify the previous Android SDK directory path instead of downloading a new one.

b) Import the project

File→Import→ Android → "Existing Android Code Into Workspace"

Choose the builds/android directory of the Player's directory as the project root.

Congratulations ! You can now work on the Player's Android port ! Tu run the program, choose a Virtual Machine with armeabi-v7a CPU, or connect an android device to your computer (don't forget to enable the USB Debugging).

development/compiling/player/android.txt · Last modified: 2016/04/01 17:33 by Francisco de la Peña