Skip to content

Update "example" keystore to instead be called "debug" and follow the debug.keystore format #79

@silbinarywolf

Description

@silbinarywolf

What should this work do?

When using debug keystore we should attempt to locate $HOME/.android/debug.keystore as per Android API docs here. Failing finding it, we should consider trying to generate the debug key and placing it in this directory (if it exists)

What is the motivation?

We won't end up blowing away the keystore generated in .zig-cache anymore which means when developers delete .zig-cache and re-build / upload their APK to their Android devices, they won't need to run uninstall. So this will improve the developer user experience.

What should be changed?

  • Add a new constant called debug (ie. const debug: CreateKey = ), this should use the example below as that follows Googles expected debug format. ie. What comes from using keytool
  • Make const example: CreateKey point at debug and add a comment saying it is deprecated.
  • Make debug first check for its own existence in the example directories listed below.
    • If it already exists, use it.
    • If it does not exist, create it in those folders.
      • ~/.android/ on OS X and Linux
      • C:\Users\user\.android\ on Windows Vista and Windows 7, 8, and 10
  • update examples to use debug instead of deprecated example constant.
  • update CreateKey name to KeyToolOptions
    • Make const CreateKey = KeyToolOptions that has a /// Deprecated: Use KeyToolOptions instead

Example of generating debug keystore

keytool -genkey -v -keystore debug.keystore -storepass android -alias androiddebugkey -keypass android -keyalg RSA -keysize 2048 -validity 10000
  • Keystore name: "debug.keystore"
  • Keystore password: "android"
  • Key alias: "androiddebugkey"
  • Key password: "android"
  • CN: "CN=Android Debug,O=Android,C=US"

Example directories of debug.keystore

  • ~/.android/ on OS X and Linux
  • C:\Users\user\.android\ on Windows Vista and Windows 7, 8, and 10
  • C:\Documents and Settings\user\.android\ on Windows XP

Android Keystore location and example output

These files were created by Android Studio after installing/running on Linux. You can make out that androiddebugkey is in the keystore file, so this is likely still the default way to generate a key.

Image Image

Related resources

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions