Making an Android APK

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
Cwmiller8012
Prole
Posts: 2
Joined: Wed May 08, 2019 6:41 pm

Making an Android APK

Post 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.
Last edited by Cwmiller8012 on Tue Jul 05, 2022 2:53 am, edited 1 time in total.
crystal
Prole
Posts: 15
Joined: Sat Sep 30, 2017 9:53 pm

Re: Making an Android APK

Post 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
Cwmiller8012
Prole
Posts: 2
Joined: Wed May 08, 2019 6:41 pm

Re: Making an Android APK

Post 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.
crystal
Prole
Posts: 15
Joined: Sat Sep 30, 2017 9:53 pm

Re: Making an Android APK

Post by crystal »

sorry im no expert in android studio
you should post your error and someone will help you for sure
User avatar
yintercept
Citizen
Posts: 64
Joined: Mon Apr 02, 2018 3:31 pm

Re: Making an Android APK

Post 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.
Back in the saddle again.
crystal
Prole
Posts: 15
Joined: Sat Sep 30, 2017 9:53 pm

Re: Making an Android APK

Post 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
zingo
Citizen
Posts: 55
Joined: Mon Jan 16, 2023 7:34 am

Re: Making an Android APK

Post 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.
Andlac028
Party member
Posts: 174
Joined: Fri Dec 14, 2018 2:27 pm
Location: Slovakia

Re: Making an Android APK

Post 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
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 2 guests