Tuesday, June 19, 2012

How to sign an android apk and zip align:

1. Right click your project in eclipse and Click Android tools – > export unsigned apk.
    Give it a name and save it in a directory.


 
2. Copy the File (eg: Myapp.apk) into "D:\Android\Android\android-sdk\tools"

3. Go to command prompt:
       To generate a key-store:
         -  keytool -genkey -v -keystore mykeystore.keystore -alias mykey -keyalg RSA -validity 10000




 3. Then generate the sign apk. and the zip align command


D:\Android\Android\android-sdk\platform-tools>keytool -genkey -v -keystore mykey
store.keystore -alias mykey -keyalg RSA -validity 10000
Enter keystore password:
Keystore password is too short - must be at least 6 characters

Enter keystore password:
Re-enter new password:
What is your first and last name?
  [Unknown]:  yuva rajan
What is the name of your organizational unit?
  [Unknown]:  mobile team
What is the name of your organization?
  [Unknown]:  evoke technologies
What is the name of your City or Locality?
  [Unknown]:  hyd
What is the name of your State or Province?
  [Unknown]:  andhara pradesh
What is the two-letter country code for this unit?
  [Unknown]:  hyd
Is CN=yuva rajan, OU=mobile team, O=evoke technologies, L=hyd, ST=andhara prades
h, C=hyd correct?
  [no]:  y

Generating 1,024 bit RSA key pair and self-signed certificate (SHA1withRSA) with
 a validity of 10,000 days
        for: CN=yuva rajan, OU=mobile team, O=evoke technologies, L=hyd, ST=andh
ara pradesh, C=hyd
Enter key password for 
        (RETURN if same as keystore password):
Re-enter new password:(yuvarajan)
[Storing mykeystore.keystore]



D:\Android\Android\android-sdk\platform-tools>jarsigner -verbose -keystore mykey
store.keystore GenericApp.apk mykey
Enter Passphrase for keystore:(yuvarajan)


D:\Android\Android\android-sdk\tools>zipalign -v 4 GenericApp.apk GenericApp_New
.apk
Verifying alignment of GenericApp_New.apk (4)...
Reference Url:
http://www.coderzheaven.com/2011/11/26/steps-to-sign-an-android-apk-and-publish-it-to-the-market/

No comments:

Post a Comment