Search

Monday, June 25, 2012

How to sign android apk for market release :certificate signing

Recently i wanted to upload my first free apk(app) to the market when i tried to upload the apk i was getting the below error: Market does not accept apks signed with the debug certificate. Create a new certificate that is valid for at least 50 years. Market requires that the certificate used to sign the apk be valid until at least May 18, 2034. Create a new certificate.

after searching a lot in android developer site i was not able to find any information but after lot of trials i came to know how to sign the apk below is the detailed procedure on how to do it

--> First of all make sure you have JDK installed.

--> create two folders "keytools" and inside it a folder named "keys" in c: or d: drive i am using desktop path in my case

C:\Documents and Settings\YOURNAME\Desktop\keytools
C:\Documents and Settings\YOURNAME\Desktop\keytools\Keys

--> Generate release signing Keys

C:\Documents and Settings\YOURNAME\Desktop\keytools>keytool -genkey -alias ScreenLock.keystore -keyalg RSA -validity 20000 -keystore keys/ScreenLock.keystore

fill the information as below you can fill all the fields or required fields according to your needs but do not forget to remember the key store password since its required during signing process of your android apk
 Enter keystore password: your secret text 
What is your first and last name?
[Unknown]:
What is the name of your organizational unit?
[Unknown]:
What is the name of your organization?
[Unknown]: Mobile Developers Inc
What is the name of your City or Locality?
[Unknown]:
What is the name of your State or Province?
[Unknown]:
What is the two-letter country code for this unit?
[Unknown]: US
Is CN=Unknown, OU=Unknown, O=mobdev, L=Unknown, ST=Unknown, C=US correct?
[no]: yes
Enter key password for <ScreenLock.keystore>
(RETURN if same as keystore password):

--> Now a new file will be created in below path named ScreenLock.keystore
C:\Documents and Settings\YOURNAME\Desktop\keytools\keys\ScreenLock.keystore

Note: Make sure you store this file because this file is needed for future upgrade of your app else If you sign the new version without using matching certificates, you will also need to assign a different package name to the application — in this case, the user installs the new version as a completely new application

--> Now the keystore is generated its time for signing the android apk / application now place your application in below path

C:\Documents and Settings\YOURNAME\Desktop\keytools\

and type below command

C:\Documents and Settings\YOURNAME\Desktop\keytools\jarsigner -verbose -keystore keys/ScreenLock.keystore -signedjar ScreenLock_signed.apk ScreenLock.apk ScreenLock.keystore

 Enter Passphrase for keystore: your secret text
adding: META-INF/MANIFEST.MF
adding: META-INF/ANDDEV_K.SF
adding: META-INF/ANDDEV_K.RSA
signing: res/drawable/icon.png
signing: res/layout/main.xml
signing: AndroidManifest.xml
signing: resources.arsc
signing: classes.dex
Now if you get output something similar to above your apk is signed and ready for market happy placing your apps on market.

below is the app i recently uploaded to the market using above signing method

https://play.google.com/store/apps/details?id=com.screeblock.mobdev.in

Note: if the above command prompt commands does not work make sure to set JAVA Environment Variables and class path properly visit this URL http://docs.oracle.com/javase/tutorial/essential/environment/paths.html for further reference, above methods are the result of bits a piece of information i got on the web its working successfully for me, if you think its not working for you and not able to sign the android apk for market using above method do let us know.

4 comments:

Gardening Expert Blog said...

I was very pleased to find this site. I wanted to thank you for this great read!! I definitely enjoying every little bit of it and I have you bookmarked to check out new stuff you post. Big thanks for the useful info...................

Unknown said...

hi, I tried this all above process works fine but still at end when i try to upload file to google it says certificate error...any idea what could be issue ???

Snowpard said...

Signing the application step by step written in this article: http://snowpard-android.blogspot.com/2012/09/google-play-signed-applications.html

Unknown said...

You posted editorial which gives users bunch of information concerning meticulous subject recognition for this allocate.
click here

Post a Comment

Other Interesting Articles



Related Article Widget by Yogith

Search Powered by Google