Game Development Reference
In-Depth Information
Table A-1 lists the possible arguments for the
keytool
command.
Table A-1.
Arguments for the Keytool Command
Argument
Description
-genkey
Generate a public and private key pair.
-v
Use verbose output.
-keystore
Specify the name of the key store.
-alias <alias_name>
Add an alias for the key pair.
-validity <valdays>
Specify the validity period in days.
-storepass <password>
Add a password for the key store.
-keypass <password>
Add a password for the key.
■
Tip
When you run your applications in the emulator, the Eclipse workbench automatically signs the application
using a debug key store. This key store can be found in
%USERPROFILE%\debug.keystore
(in Windows) and
$HOME/.android/debug.keystore
(in Linux). The debug key store password is
"android"
, and the key alias and
password are
androiddebugkey/android
.
Signing the Application
Prior to the Android SDK 1.5, the application signature had to be done manually using the Java SDK
jarsigner
command (see Listing A-1).
Listing A-1.
Windows Batch Script to Sign the Wolf3D Application Package (APK)
@echo off
set JAVA_HOME=c:\Program Files\Java\jdk1.6.0_07
set PKG=c:\tmp\APK\Wolf3D.apk
rem To sign
"%JAVA_HOME%\bin\jarsigner" -verbose -keystore ar-release-key.keystore %PKG% android_radio
rem To verify that your .apk is signed, you can use a command like this
"%JAVA_HOME%\bin\jarsigner" -verbose -verify %PKG%