Reputation: 5591
I am following this link http://eagle.phys.utk.edu/guidry/android/apiKey.html to generate MD5 fingerprint of the certificate.
I have seen following threads too :
Google maps error when trying to get my API Key for android
How to find the MD5 fingerprint of my Android App
I am using Windows xp OS .The debug.keystore is located at C:\Documents and Settings\Admin.android\debug.keystore.
but on cmd prompt it gives response network path not found.
Please guide me how can i generate MD5 digest.
And also I would like to know what is the difference in debug key and release
key ?? Are these two different keys ?? If yes then How can i generate them ??
Is there any way by adopting that we can use same debug and release keys on different machines.
Upvotes: 0
Views: 2989
Reputation: 20041
Locate debug.keystore on your system. It is usually in the USER_HOME\Local Settings\Application Data\.android
folder on windows.
Use the keytool utility to generate certificate fingerprint (MD5). keytool utility that comes with the default JDK installation.
C:>keytool -list -alias androiddebugkey -keystore .android\debug.keystore -storepass android -keypass android
You can get a temporary Maps API Key based on your debug certificate, but before you publish your application, you must register for a new Key based on your release certificate and update references in your MapViews accordingly
You may also have to obtain other release keys if your application accesses a service or uses a third-party library that requires you to use a key that is based on your private key. For example, if your application uses the MapView class, which is part of the Google Maps external library, you will need to register your application with the Google Maps service and obtain a Maps API key. For information about getting a Maps API key, see Obtaining a Maps API key.
Upvotes: 1
Reputation: 9755
get your debug signature as described below
$ keytool -list -keystore ~/.android/debug.keystore
...
Certificate fingerprint (MD5): 94:1E:43:49:87:73:BB:E6:A6:88:D7:20:F1:8E:B5:98
or better use the one you get from sigs[i].hashCode()
then this util func may also help
static final int DEBUG_SIGNATURE_HASH = 695334320;// value shpuld be the one you get above
public static boolean isDebugBuild(Context context) {
boolean _isDebugBuild = false;
try {
Signature [] sigs = context.getPackageManager().getPackageInfo(context.getPackageName(), PackageManager.GET_SIGNATURES).signatures;
Log.d(TAG, "DEBUG_SIGNATURE_HASH->"+DEBUG_SIGNATURE_HASH);
for (int i = 0; i < sigs.length; i++) {
Log.d(TAG, i+"->"+sigs[i].hashCode());
if ( sigs[i].hashCode() == DEBUG_SIGNATURE_HASH ) {
Log.d(TAG, "This is a debug build!");
_isDebugBuild = true;
break;
}
}
} catch (NameNotFoundException e) {
e.printStackTrace();
}
return _isDebugBuild;
}
Upvotes: 1