Android: Maps API Key Issues

When using Google Maps from within your Android application you need to obtain an API key in order to be able to retrieve Maps data at run-time. This API key is derived from the fingerprint of the signature key used to sign the application’s APK. Consequently, if the signature key used by your application at a given point in time no longer matches the one used to register the Maps API key, using the MapView will silently fail (the map will just display a gray grid instead of the expected map data). So far, so good.

As it seems, the Android ADT Eclipse plug-in also comes with an undocumented “feature”: If no “Custom debug keystore” is set in the Android Build Preferences, it will apparently use a different key to sign the APK when deploying it to a phone connected via USB than when deploying it to the Emulator. So, all your Maps applications will suddenly start to fail displaying map data once they are deployed on a real device for testing purposes.

To work around this issue, set the “Custom debug keystore” setting (empty by default) to the same value as the “Default debug keystore”.