Signing Android Application
with own Signature/Signing Your App Manually:
It's not required to have Android SDK to resign your application.
You can sign your application (.apk file) with your own signature from command
line tools using standard tools and JDK. Just follow below steps to sign your
app using Command Prompt
- Generate a private key
using Keytool. Ex:
Use the below command to generate Keystore:
Command: keytool -genkey -v -keystore default.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000
This 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. The alias is a name that you will use later
when signing your app
- Compile your app in release mode to obtain an
unsigned APK
- Sign your app with your private
key using jarsigner:
Command: jarsigner -verbose -sigalg
SHA1withRSA -digestalg SHA1 -keystore
Type this command in Java
installed path i.e.., Ex: C:\Program Files\Java\jdk1.7.0_51\bin\ - - Command -
-
This example prompts you for passwords for the keystore and key.
It then modifies the APK in-place to sign it. Note that you can sign an APK multiple
times with different keys
- Verify that your APK is signed. For example:
Command: jarsigner -verbose
–keystore “dubug.keystore” zippedAPp.apk androiddebugkey
- Align the final APK package using zipalign
Command: zipalign -v 4 your_project_name-unaligned.apk your_project_name.apk
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
For more
details Refer to following link: http://developer.android.com/tools/publishing/app-signing.html
No comments:
Post a Comment