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 the Command Prompt on your PC. This can be done by pressing the windows key, then typing in “cmd”.
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 the Command Prompt, go ahead and run the commands below, replacing the parts as needed. If you aren’t comfortable with the Command Prompt, we’ll go through filling in the commands step-by-step below.
C:\Program Files (x86)\android-sdk\build-tools\[build-tools version]\zipalign.exe -v 4 [path to downloaded apk] nameOfGame_zipaligned.apk
C:\Program Files (x86)\android-sdk\build-tools\[build-tools version]\apksigner.bat 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” folder in your program files directory.
Navigate to your program files directory and open up android-sdk> 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 the Command Prompt to have the path fill in automatically.
Next, in the Command Prompt, add a space, then “-v” followed by another 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 the Command Prompt to fill its path in.
Lastly, add one more space then 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 that ends in “Verification successful”.
You should also have your zipaligned APK file in your user directory (C:\Users\[the name of the Windows account you’re logged in as])
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 Command Prompt window.
Next add a space, then add “sign” followed by another space, then two dashes and a “ks” (–ks)
Add another space, then drag your keystore into the Command Prompt window to add its path to the command. (If you’ve followed the previous tutorials then your keystore should be in your user directory; C:\Users\[the name of the Windows account you’re logged in as])
Next add another space then two dashes and “in” (–in).
Add another space and drag in your zipaligned APK file that was output from the first command.
Add one more space followed by two dashes followed by “out” (–out).
Add one final space and a name for the signed APK file this command will output (i.e nameOfYourGame.apk)
Press enter to 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 the Command Prompt 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 in your users directory.