Monday, 24 October 2011

Android vs JDK7; First Act..

As some of the early adopters may have already faced, JDK7 has changed some behaviors of the 'keytool' utility. Actually this is not specific to Android but sooner or later any Android developer might need to use key tool utility.

In my case this has happened with the MapViewActivity. Those who had used MapView before will definitely remember that you need to provide an Api Key to retrieve maps. Google Maps offers a simple signup mechanism and a detailed tutorial.

Actually all you need is to extract the fingerprint of the certificate which is used for signing your application.

The following command will give you the certificate fingerprint.

keytool -list -alias alias_name -keystore my-release-key.keystore

Certificate fingerprint (MD5): 94:1E:43:49:87:73:BB:E6:A6:88:D7:20:F1:8E:B5:98

However those who had already downloaded and started using JDK7 will end up with SHA1 fingerprint instead of MD5.

Certificate fingerprint (SHA1): 33:59:42:3D:74:CB:8F:AA:A9:C4:56:3D:16:4D:0E:13:68:FC:3C:2F

Since both fingerprints are in the same format and the only difference is the extra digits on SHA1, it might not be easy to understand you are not getting what you had asked for but the solution is quite simple.

Either set your JDK version to 6 or add -v keytool command which would give you the MD5 instead SHA1.

keytool -v -list -alias alias_name -keystore my-release-key.keystore