You are still searching for an easy way to get your APK signed. I have posted multiple ways before about jar signing. But now the recommended way is using APKSigner. So, this is the time you to move with APKSigner. As usual. if your app is a new one, you must generate a keystone first by running the following code. If you have a version release, then you can use the previously generated keystone with those credentials.
Change the kdjapp word with your details.
keytool -genkey -v -keystore kdjapp.keystore -keyalg RSA -keysize 2048 -validity 10000 -alias kdjapp
After that, this can be the most important part. Because we zip aligned after signing the app in previous methods (jarsign). However, now you have to do it before signing the app. Don’t ask me the reason, however, you can find it by googling. So, let’s zipalign the app now.
zipalign -f -v 4 app-release-unsigned.apk kdjapp.apk
After zip aligning the app, you can go to the next step. But remember, you have to check the last step if you couldn’t see the apksigner on your environment variables. However, just sign the application now. (You have to get your APK out of the release folder and you can run the following code.)
apksigner sign --ks KDJKEY.keystore --ks-key-alias kdjapp kdjapp.apk
Congratulation you app is signed now. Your APK is now ready to upload on play store. (Now, new apps can’t upload to the play store as an APK. Will teach you how to do it in the next tutorial)
** Note: As I mentioned before, to run the apksigner command, you should add apksigner.bat location as the environment variable. So, this is how you can do it.
- Press CTRL + R and type %ANDROID_HOME%. Then Press Enter.
- Now go to build tools folder -> version number folder.
- Now copy the folder path by clicking on the location bar.
- Then search on windows as “Environment Variables”.
- Then go to environment properties.
- Now find the variable called “Pat” under the system variables section.
- Edit It and add the copied location there.
- Now save all the windows and enjoy the command.
So, Thank you. This is my practical view. So, I write the way how I do it. Thanks for being with us.