First think you need to do is to generate keystore file for project. Store apps needs to be signed with that and its always good to have separated keystore for each app. Keep that securely cause you need this everytime youre updating your app on store.
You can generate also using various IDEs like NetBeans, Eclipse, Android Studio and so on, but in this time we’re using command line.
user@host:~/home $ keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000
After you have built your apk (unsigned) you need to use following command to sign this with previously generated keystore.
user@host:~/home $ jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my-release-key.keystore my_application.apk alias_name
Validate signed apk:
user@host:~/home $ jarsigner -verify -verbose -certs my_application.apk
Finally align you apk to optimize it and after that it’s ready to be submitted into store.
user@host:~/home $ zipalign -v 4 my_application.apk my_application_aligned.apk