Clone wiki

love-android-sdl2 / Building LÖVE for Android - Linux

Building LÖVE for Android - Linux

This guide specifically is for Arch Linux

Todo: Add instructions in-line for Debian/Ubuntu deployment environments.

Author note: While this entire document uses arch linux, finding alternatives should not be hard with a little research.

Install the Java SDK

You need Java SDK to compile Java portion of the app.

sudo pacman -Ss jre8-openjdk jre8-openjdk-headless jdk8-openjdk 
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk/

Install the SDK

Download and install the android SDK (https://aur.archlinux.org/packages/android-sdk/) :

wget https://aur.archlinux.org/packages/an/android-sdk/android-sdk.tar.gz
tar xvf android-sdk.tar.gz && cd android-sdk
makepkg -s # Resolve dependencies
sudo pacman -U

Apache Ant

Download and install Apache ant:

sudo pacman -S apache-ant

Get the NDK tools

Download and un-package the ndk tools (http://developer.android.com/tools/sdk/ndk/index.html) In this case, my working directory is ~/bin/:

cd ~/bin/
wget http://dl.google.com/android/ndk/android-ndk-r9c-linux-x86_64.tar.bz2
tar xvf android-ndk-r9c-linux-x86_64.tar.bz2

Android Components

Install the SDK Platform Tools component

CLI:

cd /opt/android-sdk/tools/
sudo ./android update sdk -u

GUI:

sudo /opt/android-sdk/tools/android

Allow the GUI to install "Android SDK Platoform-tools" and "Android SDK Built-tools", "Android 4.4.2 (API 19)" and the "Android Support Library"

Things to install 1/2 Things to install 2/2

Select the "Accept License" radial, and click install.

*Sigh* the proprietary things we do.

Clone the love-android-sdl2 repo

Download the love-android-sdl2 repo. In this case, my working directory is ~/repos/:

cd ~/repos/
git clone https://bitbucket.org/MartinFelis/love-android-sdl2
cd love-android-sdl2

Run ndk-build

Run ndk-build on the love-android-sdl2 repo:

~/bin/android-ndk-r9c/ndk-build

Optionally you can supply the --jobs flag if you have multiple cores. Suggested usage is n+1 cores, where n is the number of cores your machine has. This is what one might use for an 8 core machine;

~/bin/android-ndk-r9c/ndk-build --jobs 9

Set up environment vars

Use export to bring in the android locations (from the aur package)

export ANDROID_SDK=/opt/android-sdk
export ANDROID_NDK=${HOME}/bin/android-ndk-r9c
export ANDROID_SWT=/usr/share/java
export ANDROID_HOME=${ANDROID_SDK}
export PATH=$PATH:$ANDROID_SDK/tools:$ANDROID_NDK

At this point, you would do all the specific changes that relate to your game. See the next section for information on how to do that.

Build

Use Apache Ant to deploy:

ant debug

You should now have a apk that should run on your device located at:

~/bin/love-android-sdl2/bin/love_android_sdl2-debug.apk

Updated