Wiki

Clone wiki

love-android-sdl2 / Building LÖVE for Android - Mac OS X

Building LÖVE for Android - Mac OS X

This is a guide for Mac OS X (tested on 10.9.2) based on the Windows and Linux guides (if you look closely there's a lot of copy-paste text from those guides).

Install Java SDK

JDK for short is needed for the Android SDK, you can find it here (select the one without NetBeans since it's not needed).

In the following page Accept the License Agreement and download the right file for your system (Mac OS X x64). Then just install the Java SDK normally.

Apache Ant

Download Apache Ant from its website in the Binary Distribution section.

Go to the "Current Release of Ant" and select the zip file.

Once downloaded unzip it in a known directory. e.g: /Developer/Tools/ant

Installing the Android SDK

Then you have to install the Android SDK.

WARNING: The Download button on the right is for preconfigured install. Instead go to "Use an existing IDE" and click that Download link.

Once downloaded unzip it in a known directory. e.g: /Developer/SDKs/android-sdk-macosx

SDK Tools

Once you have unzipped the Android SDK execute it:

sudo /Developer/SDKs/android-sdk/tools/android

and install the following tools:

  • Android SDK Platform-tools (latest)
  • Android SDK Build-Tools API 19.1
  • SDK Platform Android 4.4.2 API 19
  • ARM EABI v7a System Image API 19
  • Google APIs ARM System Image API 19
  • Sources for Android SDK API 19
  • Android Support Library

The following screenshot shows the selected tools on Android SDK Manager screen: Screen Shot 2014-03-29 at 0.19.30.png

(Install Package should be enabled to you, mine isn't because it's already installed)

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

Android NDK

Once you have the SDK tools you can get the NDK version r9d from here (Download acording to your system). This is a zip file, you can unzip it wherever you want. e.g: /Developer/Tools/ndk

Clone the love-android-sdl2 repo

Download the love-android-sdl2 repo. For this task you can use a Git tool or just download it from the Downloads section in a zip file

Git:

git clone git@bitbucket.org:MartinFelis/love-android-sdl2.git

Download:

Once in the download page go to the Tags section and there download the lastest version (.zip files are prefered)

You can place the repository wherever you want. e.g ~/repos

Set up environment vars

To avoid headaches, i do recommend to set environment variables this way:

Set Android Variables

Open up a Terminal window (you can use Spotlight, write terminal and press enter, or you can find it on the /Applications/Utilities folder) and type the following:

nano ~/.bash_profile

This will start nano text editor with (probably) a blank file. Then, you need to add the following lines to the file:

export ANDROID_HOME=/Developer/SDKs/android-sdk-macosx
export ANDROID_NDK=/Developer/Tools/ndk

If you've saved the Android SDK and/or NDK in different paths, edit them accordingly.

After that, hit Control + X (to exit the editor) and type Y (to save changes to file)

Update PATH

Still in Terminal, type the following:

sudo nano /etc/paths.d/android-sdk

and press Enter. Another text editor should open. In this file, add the following lines:

/Developer/SDKs/android-sdk-macosx/tools
/Developer/SDKs/android-sdk-macosx/platform-tools
/Developer/Tools/ant/bin

The first line is the tools folder of Android SDK folder, the second one is the platform-tools folder. And the last one is the path of bin folder of Apache Ant package. If you used different paths, edit them accordingly.

Run ndk-build

Finally (and still in Terminal), navigate to your love-android-sdl2 folder and run ndk-build:

cd ~/repos/love-android-sdl2
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;

ndk-build --jobs 9

Then, make the changes specific to your game following the Game Packaging page.

Build

Use Apache Ant to deploy:

ant debug

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

<path to your love-android-sdl2 folder>/bin/love_android_sdl2-debug.apk

Updated