Android Builds with RenPy

I spent most of today trying to figure out how to generate an Android build of YAGS. The RenPy documentation is pretty good, except if you want to have your own keystore for signing.

Start by opening RenPy and clicking the “Android” link for your game. If this is your first android build, it’ll download and install a bunch of tools and prompt you to install the Java JDK, if you haven’t already.

After all of that’s done, you can test your game by launching it (from that same "Android" link > Emulation > Phone (or Tablet)). You may need to make some tweaks, especially if you’ve done extensive GUI customization for the standard desktop form factor. In particular, note that the variant "touch" and variant "small" directives can be useful to update your screens, and that gui.rpy has several mobile-specific style overrides (such as font sizes) at the bottom of the file.

Once you’re happy with your game, it’s time to build a package. Before you do this, you may want to create and configure your own keystore and create custom icons (with thanks to Rob Colton for help with the keystore).

First, if you don’t want to use the keystore that RenPy creates for you, you can create your own with keytool:

C:\Users\Bob> cd "C:\Program Files\Java\jdk1.8.0_191\bin"

C:\Program Files\Java\jdk1.8.0_191\bin> keytool -genkey -v -alias yourkeystorealias -keyalg RSA -keysize 2048 -validity 10000

This will prompt you for various values involved in generation. You should set a keystore password, enter your name (i.e. “Bob Conway”), and your company (i.e. “bobcgames”) as the organization unit and organization. Then enter a key password. This will create a .keystore file in your user directory (i.e. C:\Users\Bob\.keystore).

(Alternately, you can use this tool, as recommended by Rob, do to keystore generation visually.)

Next, you’ll want to update your rapt settings. Navigate to renpy-7.x.x-sdk/rapt/project and open in a text editor. Edit these settings to match the values entered during keystore generation (alias, keystore and key passwords, and keystore location).

Finally, create images for the icons and presplash screen. The official documentation is pretty good about information on this, but note that the files should go in your base directory, not under /game. (This is the same directory where your icon.ico and icon.icns files go.)

You’ll also probably want your foreground image to be larger than the “minimum safe” size of 132×132 px. I just did 250×250 px for mine.

That should be enough to successfully build an apk, which you can then distribute!

Also worth noting: Multi-game persistence does not work with mobile builds. You should case all of your multi-persistence (including initializing the variable) with if not checks.

Leave a comment

Your email address will not be published. Required fields are marked *