Generate JSK and PEM Files for Android Apps
JKS (Java KeyStore) and PEM (Privacy Enhanced Mail) files are critical components in the Android app publishing
process on the Google Play Store. The KeyStore file is used for signing your Android App Bundle (.aab),
which is an acceptable extension for the Google Play Console. A PEM file is required by the Google Play Console for
validation. This process requires the keytool, which is a part of the Java Development Kit (JDK) that
can be downloaded from their official web page.
After downloading and configuring JDK, generate the KeyStore (.jks) file using the following command.
keytool -genkey -v -keystore keystore.jks -keyalg RSA -keysize 2048 -validity 10000 -alias upload
Then input the relevant details such as a password, name, work info, and location. Finally, type yes to
confirm and generate your KeyStore file. Then you will have your keystore.jks in the same directory
where you executed the command. Also, make sure to remember the alias you provided.
Now you can create the certificate file using the keystore.jks file with the following command. You
should upload this certificate to the Google Play Console so they can verify your app builds whenever
you upload one.
keytool -export -rfc -keystore keystore.jks -alias upload -file certificate.pem
For Flutter development, you need to create a key.properties file inside the
android directory of your project and define the following values in it. keyAlias and
passwords should be the same values you gave while generating the JKS file. And place the JSK file
inside the android/app directory.
storePassword=YOUR_PASSWORD
keyPassword=YOUR_PASSWORD
keyAlias=upload
storeFile=keystore.jks