How To Sign Apk

Siddhesh SonjePosted by

A Tutorial To Sign The Apk By CrYsTAxiT

>>Remember<<
You do not need Android Studio to sign your app. You can sign your app from the command line using standard tools from the Android SDK and the JDK.
To sign an app in release mode from the command line:

1. Generate a private key using keytool. Open CMD and Type:

$ keytool -genkey -v -keystore my-release-key.keystore
-alias alias_name -keyalg RSA -keysize 2048 -validity 10000

[Here, the my-release-key is name of your “Secret key” And -alias_name is can be your name or your oraganisations name].

Example:

$ keytool -genkey -v -keystore mysecretkey.keystore
-alias crystaxit -keyalg RSA -keysize 2048 -validity 10000

>>Note<<
This example prompts you for passwords for the keystore and key, and to provide the Distinguished Name fields for your key. It then generates the keystore as a file called my-release-key.keystore.
The keystore contains a single key, valid for 10000 days.
2. Once the key is made. Compile your app in release mode to obtain an unsigned APK.
3. Open the CMD for the path where you have store your key (my-release-key.keystore)
4. Now Sign your app with your private key using jarsigner:

$ jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1
-keystore my-release-key.keystore my_application.apk alias_name

Example:

$ jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore mysecretkey.keystore Sample.apk crystaxit

>>Note<<
This example prompts you for passwords for the keystore and key. (The password which you have enterd before)
It then modifies the APK in-place to sign it. Note that you can sign an APK multiple times with different keys.
5. Verify that your APK is signed.

$ jarsigner -verify -verbose -certs my_application.apk

Example:

$ jarsigner -verify -verbose -certs Sample.apk
6. Align the final APK package using zipalign.

$ zipalign -v 4 your_project_name-unaligned.apk your_project_name.apk

Example:

$ zipalign -v 4 Sample.apk Sample-Final.apk

>>Note<<
zipalign ensures that all uncompressed data starts with a particular byte alignment relative to the start of the file,
which reduces the amount of RAM consumed by an app.
If zipalign command throws error , then instead of using this command use zipalign tool.

Download ZipAlign Tool

>First Run The Zip-align.exe<<
And Follow What it Says!!!!!

 

Enjoy!!!! 

Don’t Forget To Follow Us On Google+  , Telegram and Twitter .

Leave a Reply

Your email address will not be published. Required fields are marked *