User Tools

Site Tools


tips:java:signingandroid

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

tips:java:signingandroid [2009/06/08 12:16] (current)
erik created
Line 1: Line 1:
 +====== Signing an Android Application (apk) for Release ======
 +
 +If needed, create a keystore, as follows:
 +
 +<​code>"​%JAVA_HOME%\bin\keytool"​ -genkey -v -keystore android.keystore -alias android -keyalg RSA -validity 10000</​code> ​
 +
 +You'll be asked to enter a password, name, etc.
 +
 +Sign your apk, as follows:
 +
 +<​code>"​%JAVA_HOME%\bin\jarsigner"​ -verbose -keystore android.keystore MyAndroidApp.apk android</​code>​
 +
 +
 +You could easily create a drap/drop batch file to sign & verify applications,​ using something similar to the following:
 +
 +<​code>​
 +@echo off
 +"​%JAVA_HOME%\bin\jarsigner"​ -verbose -keystore "​%USERPROFILE%\<​path_to>​\android.keystore"​ "​%1"​ android
 +if errorlevel 1 goto ERROR
 +"​%JAVA_HOME%\bin\jarsigner"​ -verify "​%1"​
 +if errorlevel 1 goto ERROR
 +goto DONE
 +:ERROR
 +@pause
 +:DONE
 +@echo on
 +</​code>​
 +
 +To install the application on the Android Device Emulator:
 +
 +  - Run the emulator
 +  - Open a command/​console window in the SDK ''​tools''​ directory
 +  - Issue the following command:
 +
 +  <​code>​adb install "<​path_to>​\MyAndroidApp.apk"</​code>​
  
tips/java/signingandroid.txt · Last modified: 2009/06/08 12:16 by erik