This documents how to build and install pelya's unofficial SDL 1.2/OpenTTD Android port.
- Unix command line environment (on Windows, Cygwin should work, MinGW might too)
Android development environment (large downloads!):
- Download the Android SDK and NDK for your operating system and extract them anywhere.
- Install a JDK. Contrary to the official Android SDK page, you do not need the Oracle JDK; version 6 or newer of the Oracle JDK or OpenJDK will definitely work.
- Install Apache Ant.
- Download source archive from the sourceforge releases page.
- If you want pre-release version, install Git and use it to clone pelya's SDL repository: git clone https://github.com/pelya/commandergenius sdl-android.
- Run command git submodule update --init project/jni/application/openttd/src from directory sdl-android, this will download OpenTTD sources with Android modificaitons.
Viewing Android changes
To view the differences between official and Android build, run commands from the directory sdl-android/project/jni/application/openttd/src:
- git remote add upstream git://git.openttd.org/openttd/trunk
- git fetch upstream
- git diff upstream/master
- git format-patch upstream/master
- Add the NDK root directory and <SDK root directory>/tools to your PATH variable.
- Change to the root directory of the cloned Git repository.
ln -s openttd project/jni/application/src
android update project -p project
There will now be a file named MainActivity-debug.apk in the
project/bin directory. This is what you need to install.
If you aren't building for the first time, you only need to run build.sh.
If you already have OpenTTD installed on your Android device, you will not be able to install the created APK as an update, and will need to uninstall the original app first. This is because you have built a debug APK, which is signed with a different cryptographic key than the releases from the Play Store. Also back up the application data, which is located at <internal storage>/Android/data/org.openttd.sdl.
Now, either copy the APK to your device and install it with "Install from unknown sources" enabled, or run
adb install project/bin/MainActivity-debug.apk with your device connected, debugging enabled and the directory with the ADB executable in your PATH variable.
An icon for OpenTTD will now be visible on your home screen. Restore the backed-up application data now, or all necessary data files will be redownloaded.