Page 1 of 1

Making an Android APK

Posted: Wed May 08, 2019 6:47 pm
by Cwmiller8012
Firstly, whenever I compile the love apk for android to test that my set up works, it says that the app cannot be install the majority of the time unless I install the debug version. However, when the debug version does install, it says the version is 0.10.2. Is there a way to compile 11.1 or 11.2 at this time? Also, are there better instructions as to how to compile my game into an apk app? I find the ones on the Game Deployment page to be quite unhelpful.

Re: Making an Android APK

Posted: Fri May 10, 2019 8:33 pm
by crystal
there is also on the website in tools section LoveToAll, LoveToAndroid tool
I personally used this tutorial https://love2d.org/wiki/Game_Distribution/APKTool
for testing game,, cause its fastest method I believe (with a BATCH scripts you can run your game on android with 1 click)
and I use android studio for final build

Re: Making an Android APK

Posted: Mon May 13, 2019 8:48 am
by Cwmiller8012
Thanks for the reply! Can you give me instructions on how to use android studio to build? I get errors everytime. I try to follow the instructions on the website but it just doesn't work.

Re: Making an Android APK

Posted: Sun May 26, 2019 4:48 pm
by crystal
sorry im no expert in android studio
you should post your error and someone will help you for sure

Re: Making an Android APK

Posted: Tue May 28, 2019 6:43 pm
by yintercept
Bump because this is an important thread.
https://love2d.org/wiki/Game_Distribution/APKTool

The author of that wiki put his discord handle at the bottom, Tae Hanazono, so that would be the first place to start. People on IRC and discord have been tremendously helpful and most people leave it running in the background and/or have it on their phone, so response times are often faster than the forum. Most people I've found tend to be eager to help. Just make sure you at least tried first. No one likes asking "what have you tried?" and hearing "uh, I didn't yet" as a response.

Re: Making an Android APK

Posted: Sun Jun 02, 2019 3:02 am
by crystal
I think "Game Distribution/APKTool" tutorial is aimed for test builds only.Or it is missing couple of more steps like signing apk(note that many android devices won't accept raw .apk from APKTool

btw. this is my build_install_run.bat script

Code: Select all

@echo off
SET mycd=%~dp0
cd D:\GameMake\LOVE\game01
call kom.bat
cd %mycd%
call adb uninstall org.love2d.android
call apktool b -o my_game.apk love_10_2
call jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore MYKEYSTORE.jks -keypass MYKEYPASS -storepass MYSTOREPASS my_game.apk key0
call adb install my_game.apk
call adb shell am start -a android.intent.action.MAIN -n org.love2d.android/.GameActivity
this BATCH file must be in same folder where apktool.jar is

and in my folder D:\GameMake\LOVE\game01
i also call another file kom.bat to compile all sources into game.love
include all files/folders in the first line of this batch script

Code: Select all

zip -r -p game.zip  main.lua Game.lua gamestate.lua conf.lua
del game.love
ren game.zip game.love
xcopy /Y game.love "D:\GameMake\LOVE TOOLS\apktool_buildgame\love_10_2\assets"
this is full automation it builds,uninstall old apk, install fresh one and run it on your android device

but if you dont want all automated
you are probably only looking for this cmd line: (signs apk with your .jks keystore)
call jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore MYKEYSTORE.jks -keypass MYKEYPASS -storepass MYSTOREPASS my_game.apk key0

i hope its helpful :D

Re: Making an Android APK

Posted: Mon Jan 16, 2023 8:39 am
by zingo
Bit late to the party on this one, but I was wondering how to create an APK as well, and this is the first thread I found on the subject. I'm only just learning Lua, and the instructions in the wiki for game distribution appear to presume some prior knowledge for generating android apps. APKTool seems to be a bit depreciated for the current version of Love2d. Any clarification, or more up to date/newbie-friendly instructions would be greatly appreciated. And if not...well...generating .love files for testing is pretty straight forward anyway. Thanks in advance for taking the time to read/reply to this.

Re: Making an Android APK

Posted: Mon Jan 16, 2023 2:16 pm
by Andlac028
You do not need to know how to generate APKs, but as Google Play Store required you to upload AAB packages, APKTool wouldn’t work, as it generates only APK

First, you need to install appropriate SDK version via Android Studio, then you change some values as game name etc in manifest and put your game source code to some specific folder and hot compile (once you install sdks, you can automate the build with script)

If you are stuck somewhere or have problem with something, just ask on the forum and someone will help you. Just try it and explain, where you are stuck.

Also if you manage to compile it, you can make some more begginner friendly instructions and post it here for future users