Terminal Signing (Optional)

These steps are for how to sign your apk via the command line using apksigner. You will need to have already created a keystore and have the Android signing tools downloaded. These steps will also assume that you followed the rest of the tutorial steps linked above.

First you will need to publish your game to your GameSalad portfolio and generate an APK file to sign by using one of the Generate APK or the Build RC buttons.

After it’s done generating, click the Download APK button to download the unsigned APK file.

Next, you will need to open up Terminal on your Mac.

We’ll be running the two following commands. One to zipalign the APK file we downloaded, and one to sign the zipaligned APK file:

If you are comfortable with using Terminal, go ahead and run the commands below, replacing the parts as needed. If you aren’t comfortable with Terminal, we’ll go through filling in the commands step-by-step below.

~/Library/Android/sdk/build-tools/[build-tools version]/zipalign -v 4 [path to downloaded apk] nameOfGame_zipaligned.apk
~/Library/Android/sdk/build-tools/[build-tools version]/apksigner sign --ks [path to your keystore file] --in nameOfGame_zipaligned.apk --out nameOfGame_signed.apk

Zipalign Command (Step-By-Step)

First you’ll want to locate your zipalign file. If you followed the getting started with Android steps it should be in your “android-sdk-macosx” folder in your home directory.

Navigate to your home directory and open up android-sdk-macosx > build-tools > the build-tools version you have (27.0.3 for me).

At the bottom of that folder you should see your zipalign file. Drag and drop it into Terminal to have the path fill in automatically.

Next, in Terminal, add “-v” followed by a space, then a “4” then another space to the command. It should look like this.

Next drag and drop the unsigned APK file you downloaded from your GameSalad portfolio page into Terminal to fill its path in.

Lastly, fill in a name for your zipaligned APK file that will be created from this command. i.e “nameOfYourGame_zipaligned.apk”

After everything is filled in, hit enter to run the command. You should see the following output, and you should have your zipaligned APK file in your home directory.

Signing Command (Step-By-Step)

Once you successfully zipaligned your APK file, you will then need to sign it before you upload it to the store.

In the same folder that zipalign is in, you should see another file named “apksigner”

Drag and drop that into the Terminal window.

Next add “sign” followed by a space, then two dashes and a “ks” (–ks)

Add another space, then drag your keystore into the Terminal window to add its path to the command.

Next add two dashes and “in” (–in). Add another space and drag in your zipaligned APK file that was output from the first command.

Add two dashes followed by “out” (–out), then another space and a name for the signed APK file this command will output (i.e the name of your game.apk)

Then run the command! It should prompt you for your keystore password. Fill in your password and hit enter (note: you won’t see anything show up in Terminal as you’re typing, but you are actually typing).

After the command finishes running you should have a signed APK file you can upload to the store.