User Tools

Site Tools


tips:java:signingandroid

Signing an Android Application (apk) for Release

If needed, create a keystore, as follows:

"%JAVA_HOME%\bin\keytool" -genkey -v -keystore android.keystore -alias android -keyalg RSA -validity 10000

You'll be asked to enter a password, name, etc.

Sign your apk, as follows:

"%JAVA_HOME%\bin\jarsigner" -verbose -keystore android.keystore MyAndroidApp.apk android

You could easily create a drap/drop batch file to sign & verify applications, using something similar to the following:

@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

To install the application on the Android Device Emulator:

  1. Run the emulator
  2. Open a command/console window in the SDK tools directory
  3. Issue the following command:
<code>adb install "<path_to>\MyAndroidApp.apk"</code>
tips/java/signingandroid.txt · Last modified: 2009/06/08 05:16 by erik