Skip to content

Game Packaging

Miku AuahDark edited this page Jan 11, 2024 · 6 revisions

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/embed of the root of the love-android repository and place your game in it:

$ cd app/src/embed
$ mkdir assets
$ cp -R path/to/your/game assets/

For Windows, use this instead

>cd app\src\embed
>mkdir assets
>xcopy path\to\game assets\ /s /e /y

Before deploying, you must know if your game uses microphone or not. If your game uses microphone, you need to add Record to the build script. Otherwise you need to add NoRecord.

To deploy with microphone permission: gradlew assembleEmbedRecord (APK) To deploy without microphone permission: gradlew assembleEmbedNoRecord (APK)

You can append Debug or Release if needed. From now on, the build is referred as gradlew assembleEmbed<record?>.

You should now have an APK that should run on your device located at app/build/outputs/apk/embed<record?>(Debug|Release). The Release APK is not signed, thus you need to sign it manually.

How to change the application ID, the version, and the application name

Note

Application ID must be unique to your application and unique everywhere.

Open gradle.properties and modify as needed. A diff might look like this for example

diff --git a/gradle.properties b/gradle.properties
index 02aa6ca7..8914ad77 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -3,13 +3,13 @@
 # * Use `app.name` if your app name doesn't contain any non-ANSI characters.
 # * Otherwise, convert your app name to UTF-8 byte array, comma delimited, and put
 #   it in `app.name_byte_array`
-#app.name=LÖVE for Android
-app.name_byte_array=76,195,150,86,69,32,102,111,114,32,65,110,100,114,111,105,100
+app.name=LoveBurgers 0.1
+#app.name_byte_array=76,195,150,86,69,32,102,111,114,32,65,110,100,114,111,105,100
 
 app.application_id=org.love2d.android
 app.orientation=landscape
-app.version_code=32
-app.version_name=11.5a
+app.version_code=1
+app.version_name=0.1
 
 # No need to modify anything past this line!
 android.enableJetifier=false
  • app.name or app.name_byte_array is for your application display name in launcher. Due to limitation to gradle.properties file, if your application name contains non-ANSI characters, you must use the app.name_byte_array, otherwise use app.name. Only one of them must be defined, not both.
  • app.application_id is your game application ID.
  • app.version_code is your game version code. Increasing this number renders means a new update to existing application (and prevents downgrading). This means, for every version you released, (major, minor, and patch releases), increment the app.version_code by 1.
  • app.version_name is your game displayed version. This should be human-readable unlike above. It's recommended to use your own semantic versioning (in this example, to 0.1).

After modifying it as necessary, re-deploy.

How to change the icon

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

  • drawable-hdpi/love.png (72x72)
  • drawable-mdpi/love.png (48x48)
  • drawable-xhdpi/love.png (96x96)
  • drawable-xxhdpi/love.png (144x144)
  • drawable-xxxhdpi/love.png (192x192)

Here is an example set:

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

Then re-deploy.

How to create Android Application Bundle

Instead of running gradlew assembleEmbed<record?>Release, run gradlew bundleEmbed<record?>Release. The AAB can be found in app/build/outputs/bundle/embed<record?>Release