Before publishing to the Google Play Store you need to have a digital signature for your app.
If someone was able to get your login details they still would not be able to upload a new release of your app because only you have the keystore
on your computer.
It's really simple and easy to accomplish this and can be done under 5mins.
The command you need is:
Windows:
|
|
Mac\Linux:
|
|
If you don't have the keytool
command on your cmd
, you might need to include it in your PATH, or you can go directly to the location of the keytool.exe
and execute it from there.
|
|
So now you are in the java bin directory you should see a program called keytool.exe
You should be able to run the keytool
command from this location now.
You can change the location of where you want the key.jks
file to be saved. This key can be used for multiple apps, so saving it in a central location might be a good idea. DO NOT SAVE TO SOURCE CONTROL!!! That would defeat the purpose of signing.
Now that we the key.jks
file we need to include it in our app.
Create a file in the android root folder named key.properties with this:
|
|
This is just some meta information about your key which will be used in the next step.
Go to the android/app/build.gradle
file and include this before the android {}
block of code.
|
|
This is what I mentioned before, here we are adding the code to load the key.properties
file when building.
Last but not least we need to add this before the buildTypes{}
block of code:
|
|
And that's all. Whenever we build our application in release mode, it would automatically sign the app without us having to do anything. Just make sure not to move or delete the key.jks
file from the directory you saved it in.