Compiling the Android-SDL port of ScummVM
This page describes how to build the Android-SDL port of ScummVM (supporting SDL 1.2) from the ScummVM source tree.
In order to build the androidsdl port you will need a 64-bit Linux OS installation with an Internet connection.
The following has been tested in lubuntu 64-bit 16.04.6 LTS (xenial), kernel 4.15.0-47-generic.
- It's recommended that you have at least 20 GB of free space on your home partition before you begin this process.
- Make sure you have the latest updates for your OS by running from a shell terminal:You can also check the Software Updater GUI utility (or similar) for additional pending updates, such as kernel updates or Ubuntu Base updates (for Ubuntu based distributions). Reboot your PC, if you are prompted to.
sudo apt-get update sudo apt-get upgrade
- Install the Linux packages that are required for the build:
sudo apt-get install build-essential sudo apt-get install git
- Install the JDK. You can do this using the apt-get tool or by downloading the JDK from Oracle's official site (in the latter case you must set environment variables for JDK; see guides on "How install JDK and set environment variables for JDK").
sudo apt-get install openjdk-8-jdk
Install the Android SDK and NDK
This guide assumes that you create an "~/Android" folder inside your home directory to put the Android SDK and NDK.
Install Android SDK with command line tools only
Navigate to url: https://developer.android.com/studio/index.html
Download the "Command line tools only" packet for Linux ("sdk-tools-linux-4333796.zip" at the time of this writing).
- Create an "~/.android" and an "~/Android" folder in your home directory. Then, create a "~/Android/android-sdk" subfolder.
To do this from a shell terminal, issue:
mkdir ~/.android mkdir ~/Android mkdir ~/Android/android-sdk
- Unpack the command line tools zip file inside the "~/Android/android-sdk" folder. This should create a "tools" subfolder.
- Install the required Android SDK tools.
Using a shell terminal issue:Accept any license agreement you are prompted with during the above installation process. Also, for good measure, issue the following command, then review and accept any pending license agreements:
touch ~/.android/repositories.cfg cd ~/Android/android-sdk/tools/bin ./sdkmanager --install "platforms;android-26" ./sdkmanager --install "build-tools;26.0.0" ./sdkmanager --install "extras;android;m2repository"Then, using the following command verify that you've installed the correct tools:
./sdkmanager --licensesYou should see a printout that begins like the following:
Path | Version | Description | Location ------- | ------- | ------- | ------- build-tools;26.0.0 | 26.0.0 | Android SDK Build-Tools 26.0.0 | build-tools/26.0.0/ extras;android;m2repository | 47.0.0 | Android Support Repository | extras/android/m2repository/ platforms;android-26 | 2 | Android SDK Platform 26 | platforms/android-26/ tools | 26.1.1 | Android SDK Tools 26.1.1 | tools/
Install Android SDK with Android Studio
Alternatively, you could download and install the Android Studio for Linux 64-bit. You can then use the sdk-manager GUI tool to install the required additional tools and SDK resources. Use the above list as a guide to what packages you should download and install.
Install the Android NDK
Install the r15c (July 2017) version for Android NDK ("android-ndk-r15c-linux-x86_64.zip"). Newer versions are currently not supported.
The r15c NDK can be found in the following url: https://developer.android.com/ndk/downloads/older_releases.html
Extract the zip file you downloaded into the "~/Android" folder. This should create a "android-ndk-r15c" subfolder.
Set the environment variables for the session
For this purpose you can create and use a simple "setenv-android.sh" script. Within this script define the environment variables for the paths to your SDK tools and NDK.
Sample (suggested) script:
#!/bin/sh export ANDROID_HOME=~/Android/android-sdk export ANDROID_SDK_ROOT=~/Android/android-sdk export ANDROID_NDK_HOME=~/Android/android-ndk-r15c export ANDROID_SDK_TOOLS=$ANDROID_HOME/tools export ANDROID_SDK_BTOOLS=$ANDROID_HOME/build-tools/26.0.0 export PATH=$ANDROID_NDK_HOME:$ANDROID_SDK_TOOLS:$ANDROID_SDK_BTOOLS:$PATH
Save the "setenv-android.sh" script in your "~/Android" folder.
In order to apply the script run from a shell terminal:
Verify that your environmental variables have been set correctly by running:
You should see your NDK and SDK paths at the start of the $PATH variable.
WARNING: These environmental variables will be set only for that particular command-line session; You will need to re-run this script (by using the above
source command), if you start another shell terminal session. You should not have to re-run this script within the same shell terminal session.
Create a keystore
Create and put a keystore (you can use the debug version) in "~/.android/debug.keystore" in order to be able to sign the apk file that will be built.
To create a debug key store, run from the shell terminal the following two (2) commands:
keytool -genkey -v -keystore ~/.android/debug.keystore -storepass android -alias androiddebugkey -keypass android -keyalg RSA -keysize 2048 -validity 10000
keytool -importkeystore -srckeystore ~/.android/debug.keystore -destkeystore ~/.android/debug.keystore -deststoretype pkcs12
Enter "android" without the quotes when asked for the keystore password.
Clone the ScummVM repository
This guide assumes that you run the clone command from your home directory:
cd ~ git clone https://github.com/scummvm/scummvm.git
The above command will create a "scummvm" folder in your home directory.
Provided that you completed the above steps, you can now start building the android-sdl port project by issuing the following commands from a terminal session where you have already set the Android SDK and NDK environment variables:
cd ~/scummvm/dists/androidsdl ./build.sh
If the process completes successfully, an apk file named "scummvm-debug.apk" file will be stored in that folder (~/scummvm/dists/androidsdl).
Since this apk file is self-signed, you will need to enable installation by third-party sources on your Android device in order to install it.
Note: You can significantly reduce the build time, if you target a specific Android architecture and/or build ScummVM for specific game engines only.
- In order to target specific architectures edit the following line from the "~/scummvm/dists/androidsdl/scummvm/AndroidAppSettings.cfg" file:
MultiABI="armeabi-v7a arm64-v8a x86 x86_64"
The above line is only an example; you might have to specify another architecture for your specific use case.
- In order to build the scummvm androidsdl port for specific engines only:
- Open the "~/scummvm/dists/androidsdl/scummvm/AndroidBuild.sh" file
- Find the following line which contains the configure command:
$ANDROIDSDL/project/jni/application/setEnvironment-$1.sh sh -c "cd scummvm/bin-$1 && env LIBS='-lflac -lvorbis -logg -lmad -lz -lgcc -ltheora -lpng -lfreetype -lfaad -lgnustl_static' ../configure --host=androidsdl-$1 --enable-zlib --enable-vorbis --enable-mad --enable-flac --enable-png --enable-theoradec --disable-sdlnet --disable-libcurl --disable-cloud --enable-vkeybd --enable-release --enable-mt32emu --disable-readline --disable-nasm --disable-timidity --disable-fluidsynth --datadir=. "
- Edit the line and, after "
../configure", add "
--disable-all-engines --enable-engine=YYYY", where in place of "
YYYY" you should specify game engine for which you want to build ScummVM.
For example (building only for the bladerunner engine):
$ANDROIDSDL/project/jni/application/setEnvironment-$1.sh sh -c "cd scummvm/bin-$1 && env LIBS='-lflac -lvorbis -logg -lmad -lz -lgcc -ltheora -lpng -lfreetype -lfaad -lgnustl_static' ../configure --host=androidsdl-$1 --disable-all-engines --enable-engine=bladerunner --enable-zlib --enable-vorbis --enable-mad --enable-flac --enable-png --enable-theoradec --disable-sdlnet --disable-libcurl --disable-cloud --enable-vkeybd --enable-release --enable-mt32emu --disable-readline --disable-nasm --disable-timidity --disable-fluidsynth --datadir=. "