Signing android apps with Unity

Due to security issues, every app coming to Google Play must include valid certificate (certificate fingerprint) in a form of sha1 hash. SHA1 hash is a protection from uploading un-authorized apps for exameple in a case of hacked Google Play Console account. Since version 1, all next versions of an app must be signed with the same key.

SHA1 hash is created on basis of app keystore. Creating an app keystore is directly from Unity → (in Android platform build): File/Build Settings/Player Settings/Publishing Settings/Keystore Manager. Important! Do not lose passwords of your created keys, you need them for every next build!

Process of creating may be following:
Press Keystore Manager button → select option Create New → Anywhere and create a new folder named "keys" to your "Asset folder". This can be easily memorable and findable location of your keystore.

Once keystore file is created, theer is need to get SDH1 hash of the file. This is possible via keytool plugin. This plugin is part of Java library which was installed in point 1 of Unity configuration for creating games for Android devices. Access and use the plugin is possible via a command line - from subfolder "bin" of installed Java library in your PC, use command "keytool -list -v -keystore your_keystore_created_location".

Progress to sign an app

  1. Create keystore file in Publishing Settings inside Unity. Remember used passwortds.
  2. Run command keytool -list -v -keystore "path_to_created_keystore_file".
  3. Rewrite and save printed SHA1 hash for inserting it to Google Play.