DEV Community

Cristopher Coronado
Cristopher Coronado

Posted on

10

Create key store and sign APK manually

In this article, we will learn how to create a release key store for Android app and then sign it.

Requirements:

1. Create private keystore

Make sure keytool command is global available (You can find in C:\Program Files (x86)\Java\jdk1.8.0_181\bin).

image



keytool -genkeypair -v -keystore <RELEASE_KEY_PATH> -alias <RELEASE_KEY_ALIAS> -keyalg RSA -keysize 2048 -validity 10000  


Enter fullscreen mode Exit fullscreen mode

Example:

image

2. Apply zipalign

The zipalign file alignment tool makes it possible to greatly optimize Android application (APK) files.
I have Android Studio installed, so my Android SDK location is C:\Program Files (x86)\Android\android-sdk.
You have to use the latest Android SDK installed path. In my case is C:\Program Files (x86)\Android\android-sdk\build-tools\27.0.3.
The APK_UNSIGNED_PATH is a Release APK.



zipalign -f -v 4 <APK_UNSIGNED_PATH> <APK_PATH>


Enter fullscreen mode Exit fullscreen mode

image

3. Sign APK

In the same path from step 2.



apksigner sign --ks <RELEASE_KEY_PATH> --ks-key-alias <RELEASE_KEY_ALIAS> <APK_SIGNED_PATH>


Enter fullscreen mode Exit fullscreen mode

Verify signature in APK:



apksigner verify <APK_SIGNED_PATH>


Enter fullscreen mode Exit fullscreen mode

If everything is correct you won't see errors in the console.

Thanks for reading

Thank you very much for reading, I hope you found this article interesting and may be useful in the future. If you have any questions or ideas that you need to discuss, it will be a pleasure to be able to collaborate and exchange knowledge together.

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

Top comments (2)

Collapse
 
amelia_james_b87f48b56240 profile image
Amelia James

This guide on signing APKs manually is excellent! It’s an essential step to ensure the integrity and security of your Android applications. If you’re looking for a reliable cloud solution to store your app builds or APK files, [dlloklok.com ](url)is a great choice.

Collapse
 
lily_rose_98ea4f0daa3e03d profile image
Lily Rose

Great guide on signing APKs manually! This process really ensures the integrity and security of your Android apps. For anyone storing their app builds or looking for a safe cloud solution for their APKs, Terabox Mod APK is a great option for additional storage. Check it out here: teraboxmodapk.me/

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay