Configure Eclipse to use signed keystore

Solution 1:

You can configure a custom keystore to use for your debug builds (the ones that happen when you click Run...) in Eclipse by going to Preferences -> Android -> Build and entering the file name in the "Custom debug keystore" option.

However, it has the caveat that it must follow the same rules as a traditional debug keystore, mainly:

  1. The keystore password must be "android"
  2. It must contain a key named "androiddebugkey"
  3. That key's password must be "android"

Therefore, while it is possible to sign your apps in debug with the same keystore as you Export with, it requires your production keystore to look like a debug store, which makes it less secure if someone got ahold if the file (it would be easier to inspect and guess the passwords).

HTH

Solution 2:

I was able to to use my Google Play release keystore as my custom debug keystore to help with debugging in-app purchase functionality. The same could no doubt be applied to debugging Google Maps stuff as well.

As Devunwired mentioned, there are caveats. But my solution was this:

  1. Copy your release key somewhere.
  2. Change the keystore password/key password and key alias following the instructions here (also, following Devunwired's recommendations to make it look like a debug keystore).
  3. Change Eclipse's Preferences > Android > Build > Custom keystore setting to the path of the copy made in step 1.
  4. Done!

Solution 3:

In order for Eclipse to sign automatically for you when you deploy you need to set up a keystore which behaves like the debug keystore. This means there must be an 'androiddebugkey' and both the key and keystore password must be 'android'. Therefore, I'd recommend the following:

  1. Make a copy of your keystore, I copied mine to a file called iap.keystore
  2. Open terminal/command window with keytool on the path (for me the path is D:\NVPACK\jdk1.6.0_45\bin\keytool.exe) or use the fullpath to keystore in the commands below
  3. Change your keystore password to 'android':
    • keytool -storepasswd -keystore iap.keystore
    • Follow prompt to enter your old keystore password
    • Follow prompt to enter android as the new password
    • Follow prompt to confirm android as the password
  4. Rename your key to androiddebugkey (replace Old_Key_Store_Name with your current key name in the next command)
    • keytool -changealias -keystore iap.keystore -alias Old_Key_Store_Name -destalias androiddebugkey
    • Follow prompt to enter your keystore password (which is now andorid)
    • Follow prompt to enter your Old_Key_Store_Name password (this is whatever you previously had your key password set to)
  5. Change the password for your androiddebugkey
    • keytool -keypasswd -keystore iap.keystore -alias androiddebugkey
    • Follow prompt to enter your keystore password (which is now andorid)
    • Follow prompt to enter your androiddebugkey password (this is whatever you previously had your key password set to)
    • Follow prompt to enter android as the new key password
    • Follow prompt to confirm android as the key password
  6. You now have a keystore (with key) which Eclipse can use to automatically sign builders.
  7. Load up Eclipse.
  8. Window -> Preferences -> Android -> Build
  9. Follow 'Custom debug keystore' browse to the iap.keystore file we previous created
  10. OK

Now when you launch/debug your project, it'll use the keystore we just set up to sign your project. This will allow things like IAP to work.

BEWARE: this is convenient, but of course if someone gets hold of your iap.keystore they will be able to sign things as you by using 'android' as the keystore/key password. Hopefully this is obviously from the steps listed above, but just take a second to appreciate what this means for yourself (or your company). Then based on that decide if the risks are acceptable, and if you need to carry out any extra measures to ensure the safety of this file.