0

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.

  1. Please guide me how can i generate MD5 digest.

  2. 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 ??

  3. Is there any way by adopting that we can use same debug and release keys on different machines.

Community
  • 1
  • 1
Shruti
  • 1
  • 13
  • 55
  • 95
  • @Padma Kumar : yes i generated the md5 certificate but i am still in doubt between debug key and release key .. – Shruti Dec 30 '11 at 10:44
  • refer this: http://blogprogramistyandroid.blogspot.com/2011/04/converting-release-keys-to-debug.html – Padma Kumar Dec 30 '11 at 10:49
  • The release key is the one used to sign apps allowing you to upload the apps to the Android Market. The debug key is which is used to "push" your app while testing to your device / emulator. For the purpose of getting your MD5 certificate, you need to use the debug key and not your release key. – Siddharth Lele Dec 30 '11 at 11:30
  • @SiddharthLele : thanks for reply : ok so i can use other key to sign n export my application ?? please give me some guidance on my 3rd question – Shruti Dec 30 '11 at 12:03
  • I am not sure about using a different debug key on a different machine for the Maps API. But you certainly don't need to use a different release key. In fact, it is recommended that you store the release key somewhere safe. Once you sign an application with a specific release key, only that key can be used to provide subsequent updates for your app. Again, regarding the debug key, I really have no clue how that works. – Siddharth Lele Dec 30 '11 at 12:45

2 Answers2

1
  • 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.

refer this:

Padma Kumar
  • 19,893
  • 17
  • 73
  • 130
1

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;
        }
Yilmaz Guleryuz
  • 9,313
  • 3
  • 32
  • 43
  • Thanks @WareNinja : plz answer my 3rd Question – Shruti Dec 30 '11 at 12:04
  • sure welcome. unfortunately i don't have clear answer to 3rd question, let me try as far as i know; only debug key changes per machine, release key is the same for signed apps. thats why i do update debug key per machine and check isDebugBuild accordingly. – Yilmaz Guleryuz Dec 30 '11 at 12:52