Step 9 - Generating a keystore to sign our file
To use the APK file generated on the previous step with an Android emulator, we don't need to do anything else. But when we're ready to test the game on a real device, as a security measure, Android requires our file to be authenticated (signed) which means we'll need an extra step so we're able to test it on real devices.
We are going to generate a key that will be reused every time we need to build the project again. I won't go into details explaining what a keystore is and we definitely don't need to know much more of the subject to be able to build our game. We just need an authentication key that will be stored somewhere and we'll use that key to sign our app using command-line tools. I will explain how to do it.
9.1 - First, use the keytool command line tool to generate a new keystore. Save that keystore file to somewhere safe. We'll reuse that same file constantly. To make the tutorial simple, we will create the key in the same folder as the APK files.
Type in the following command:
"keytool -genkey -v -keystore MyFirstKeystore.keystore -alias MyFirstKS -keyalg RSA -keysize 2048 -validity 10000"
Then we'll be prompted to answer a few questions like name, organization, etc. and finally a password with six digits or more.