OBT available for Android


Hey guys!

I finally deployed this game for Android!


As I had some difficulties, I decided to make this post to complain about how anoying it was make a small tutorial for deploying an APK for Android with DragonRuby, more specifically for Android 11, for however found these same difficulties. I will show the steps I followed and the errors I found, and then how I fixed it. (It's not hard, but I was not finding what I needed to make it work). 

For this, you will need the Android SDK installed on your machine.

So, dragonruby-publish will generate a [mygame]-android.apk and mygame-android/ directory on the builds/ directory. You can generate only these files with the command.

$ dragonruby-publish --platforms=android --only-package

After this, you need to sign the apk. For this you need a keystore, that you can generate with the command.

$ keytool -genkey -v -keystore mygame.keystore -alias mygame -keyalg RSA -keysize 2048 -validity 10000

Then you need to sign the apk and install. It should be very simple:

$ apksigner sign --ks mygame.keystore [mygame]-android.apk
$ adb install [mygame]-android.apk

But (of course) it didn't work. First problem I found was this:

adb: failed to install one-button-turret.apk: Failure [INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME: Invalid manifest package: bad character '-']

This problem was caused by having '-' in the fields in the metadata file.

devid=ninus-hideon << here
devtitle=Ninus Hideon 
gameid=one-button-turret  << and here
gametitle=One Button Turret 
version=0.9.5 
icon=metadata/icon.png

So, I changed it to remove the '-'s and tried again:

adb: failed to install onebuttonturret-android.apk: Failure [-124: Failed parse during installPackageLI: Targeting R+ (version 30 and above) requires the resources.arsc of installed APKs to be stored uncompressed and aligned on a 4-byte boundary]

I searched and found that I should use 'zipallign' to align the package in these 4-byte boundary before signing it and try to install

$ zipalign -p -f -v 4 onebuttonturret-android.apk onebuttonturret-android-aligned.apk
$ apksigner sign --ks mygame.keystore [mygame]-android.apk

But NOTHING WAS WORKING, GODAMMIT!!!

But, then, before deciding to ask in the DR discord if someone was having the same problem as me and had a solution as they probably have, I found this: https://stackoverflow.com/questions/69667830/targeting-r-version-30-and-above-re...
I have no idea how i did not see this post on stack overflow, as I searched for some time how to make this shit work.

So, the process to generate the apk became this:

$ dragonruby-publish --platforms=android --only-package
$ cd ./builds/[mygame]-android/
$ zip -n "resources.arsc" -qr ../zipped.apk *
$ cd ..
$ zipalign -p -f -v 4 zipped.apk [mygame].apk
$ apksignder sign --ks mygame.keystore [mygame].apk

And now I could install the game with no problems on my device.

So... that's it! Now you an me can play this game on the smartphone with a better performance than the web version. Cheers!

Files

onebuttonturret-android.apk 13 MB
Jan 18, 2023

Get One Button Turret

Download NowName your own price

Leave a comment

Log in with itch.io to leave a comment.