Clone wiki

love-android-sdl2 / Game Packaging

Game Packaging

This documentation entails game packaging:

For set up instructions see:

How to package the apk with your own LÖVE game

Create a folder named assets in 'app/src/main' of the root of the love-android-sdl2 repository and place your game in it; you can use the shell (Windows user should use copy instead of cp):

cd app/src/main
mkdir -p assets
cp ~/path/to/your/game/foo.love assets/game.love

Note: your game file must be called game.love for the application to find it.

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-debug.apk

How to give your package a unique name

This will prevent the apl from overwriting any apk that was installed with the same package name.

Update the AndroidManifest.xml

Change the manifest's package name to the package name of choice. In this example, my name is josefnpat, my game is called loveburgers and my custom Java class name will be BurgerActivity. My manifest string would be com.josefnpat.loveburgers and my activity name would be BurgerActivity.

I would take these strings, and add them to my AndroidManifest.xml

A diff might look like this:

diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index b8c2be6..527505b 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<manifest package="org.love2d.android"
+<manifest package="com.josefnpat.loveburgers"
       android:versionCode="13"
       android:versionName="0.10.0"
       android:installLocation="auto" xmlns:android="http://schemas.android.com/apk/res/android">
@@ -14,7 +14,7 @@
         android:label="Löve for Android"
         android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
         <activity
-            android:name="GameActivity"
+            android:name="BurgerActivity"
             android:configChanges="orientation|screenSize"
             android:label="Löve for Android"
             android:screenOrientation="landscape" >

Create your activity extension

Take your package name (com.josefnpat.loveburgers) and your activity name (BurgerActivity) and create the following file in src/com/josefnpat/loveburgers/:

BurgerActivity.java

package com.josefnpat.loveburgers;
import org.love2d.android.GameActivity;

public class BurgerActivity extends GameActivity {}

This basically overrides the apk's default activity while extending from the main android GameActivity.

Then re-deploy.

How to change the version

love-android-sdl2 defaults to it's current version of the love engine:

0.10.0

Therefore I would suggest when deploying, append your game name and version to the end.

0.10.0-loveburgers-v0.1

With this in mind, update the AndroidManifest.xml section named android:versionName. This is what a diff might look like:

diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 96dfa04..a71e15a 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <manifest package="org.love2d.android"
       android:versionCode="13"
-      android:versionName="0.10.0"
+      android:versionName="0.10.0-loveburgers-v0.1"
       android:installLocation="auto" xmlns:android="http://schemas.android.com/apk/res/android">
     <uses-permission android:name="android.permission.INTERNET"/>
     <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>

Then re-deploy.

How to change the name

You will have to update the AndroidManifest.xml in two places. For this, you will need two strings:

A string that will show when:

  • You are installing it
  • Are looking at the app info

e.g. LoveBurgers 0.1

This string can be found under application[android:label].

A string that will show when:

  • You view it in the task manager.
  • You are presented with an icon with the text under it.
  • You view it in the applications manager.

e.g. LoveBurgers

This string can be found under application activity[android:label].

For both of these strings, this is what a diff could look like:

diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 96dfa04..9c2ca56 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -8,12 +8,12 @@
 <application
         android:allowBackup="true"
         android:icon="@drawable/ic_launcher"
-        android:label="Löve for Android"
+        android:label="LoveBurgers 0.1"
         android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
         <activity
             android:name="GameActivity"
             android:configChanges="orientation|screenSize"
-            android:label="Löve for Android"
+            android:label="LoveBurgers"
             android:screenOrientation="landscape" >
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />

Then re-deploy.

How to change the icon

Simply replace the following images in the res folder with PNG's of the same size:

  • drawable-hdpi/ic_launcher.png (72x72)
  • drawable-mdpi/ic_launcher.png (42x42)
  • drawable-xhdpi/ic_launcher.png (96x96)
  • drawable-xxhdpi/ic_launcher.png (144x144)

NOTE: If you are depoying to the OUYA you should include the OUYA Coverflow image, for more information check Deploying to the OUYA - OUYA System Icons

Here is an example set:

drawable-xxhdpi drawable-xhdpi drawable-hdpi drawable-mdpi

Then re-deploy.

Updated