Signing in Debug Mode

Appportunity

Build your own Android App Dev Empire

Get Instant Access

The Android build tools provide a debug signing mode that makes it easier for you to develop and debug your application, while still meeting the Android system requirement for signing your .apk when it is installed in the emulator or a device. When you use debug mode, the SDK tools invoke Keytool to create a debug keystore and key.

The SDK tools create the debug keystore/key with predetermined names/passwords;

• Keystore name - "debug.keystore"

• Keystore password - "android"

• Key alias - "androiddebugkey"

• CN - "CN=Android Debug,O=Android,C=US"

If necessary, you can change the location/name of the debug keystore/key or supply a custom debug keystore/key to use. In Eclipse/ADT, you can use Windows > Prefs > Android > Build. However, any custom debug keystore/key must use the same keystore/key names and passwords as the default debug key (as described above).

| Note: You cannot release your application to the public when signed with the debug certificate. Eclipse Users

If you are developing in Eclipse/ADT and have set up Keytool as described above, signing in debug mode is enabled by default. When you run or debug your application, ADT signs the .apk with the debug certificate and installs it on the emulator. No specific action on your part is needed, provided ADT has access to Keytool.

Ant Users

If you use Ant to build your .apk files, debug signing mode is enabled by using the debug option, assuming that you are using a build.xml file generated by the android tool. When you run ant debug to compile your app, the build script generates a keystore/key and signs the .apk for you. No other action on your part is needed. Read Developing In Other IDEs: Building in debug mode for more information.

Expiry of the Debug Certificate

The self-signed certificate used to sign your application in debug mode (the default on Eclipse/ADT and Ant builds) will have an expiration date of 365 days from its creation date.

When the certificate expires, you will get a build error. On Ant builds, the error looks like this:

debug:

[echo] Packaging bin/samples-debug.apk, and signing it with a debug key... [exec] Debug Certificate expired on 8/4/08 3:43 PM

In Eclipse/ADT, you will see a similar error in the Android console.

To fix this problem, simply delete the debug.keystore file. The default storage location for AVDs is in ~/.android/avd on OS X and Linux, in C:\Documents and Settings\\.android\ on Windows XP, and in C:\Users\\.android\ on Windows Vista.

The next time you build, the build tools will regenerate a new keystore and debug key.

Note that, if your development machine is using a non-Gregorian locale, the build tools may erroneously generate an already-expired debug certificate, so that you get an error when trying to compile your application. For workaround information, see the troubleshooting topic I can't compile my app because the build tools generated an expired debug certificate.

Was this article helpful?

0 0

Responses

  • REETA
    Where can i fine the sdk tools create the debug keystore/key with predetermined names/passwords:?
    7 years ago

Post a comment