10

I am working with the Google Map Android API v2 in an android application.

It works fine with the unsigned apk on a different device. But when I have signed the apk and uploaded my application to the Play Store the downloaded application displays a white screen instead of the map.

Chris
  • 2,885
  • 18
  • 25
Harshid
  • 5,701
  • 4
  • 37
  • 50

6 Answers6

13

What type of keystore you are using? there are two keys. Debug and release key. If you use debug key and uploaded in android market, map will look blank. Use release key when you signed your apk.

Release key procedure

Step 1:

Say for example your apk name is A and you are signing and creating a keystore for A.apk ie A.keystore will be created in some drive location.Let's consider it in E drive.

step 2:

Now locate to jdk in C drive(Considering for windows and assigning C drive)

C:\Program Files\Java\jdk1.7.0\bin>keytool -list -v -keystore E:\A.keystore -alias A

So it will create SHA-1 finger print.

Harshid
  • 5,701
  • 4
  • 37
  • 50
Shadow
  • 6,864
  • 6
  • 44
  • 93
  • I did this steps. I took the SHA-1 and added to it the package name of my google map app in api console and it took the api_key generated and added to manifest.xml. and do run from eclipse to my device, the map works well but when I uploaded the apk to play store, it still gives me the blank view. – Eman87 Sep 17 '13 at 09:36
  • @HakunaMatata how to find release key ? – Roadies Oct 31 '13 at 14:03
  • @Roadies above mentioned answer is release key. – Shadow Nov 01 '13 at 04:48
  • @madhusudhan what issue? you need debug or release key? – Shadow Apr 14 '15 at 06:29
  • same problem i am also facing ,what i have used for SHA1 key is from Exporting signed apk last screen it will show MD5, SHA1 is it right?? – madhu527 Apr 14 '15 at 06:34
  • you got SHA1 finger print? you need to use SHA1 and not MD5 – Shadow Apr 14 '15 at 06:37
  • yeah i got it just what i have used i will show you on last post below. just correct me am i right or not? – madhu527 Apr 14 '15 at 07:05
  • @Roadies keytool -list -alias MyAndroidKey -keystore C:\Users\myUser\.android\android.jks -storepass mystorepass -keypass mykeypass – iOSAndroidWindowsMobileAppsDev Aug 26 '16 at 11:24
  • can i able to see the map with releasae key in devices with out upload in playstore – Harsha Sep 26 '16 at 09:52
9

This happens because mapApi key is different for signed apk and unsigned apk.

You have to generate SHA1 key using your keystore with which you singned your apk.

Don't worry just follow the steps.

open terminal and fire command

keytool -list -alias -keystore -v

Alias name: abcd

Creation date: 15 Mar, 2013

Entry type: PrivateKeyEntry

Certificate chain length: 1

Certificate[1]:

Owner: CN=abc, OU=abc, O=abc, L=abc, ST=abc, C=91

Issuer: CN=abc, OU=abc, O=abc, L=abc, ST=abc, C=91

Serial number: 5142a21d

Valid from: Fri Mar 15 09:52:53 IST 2013 until: Sat Mar 03 09:52:53 IST 2063

Certificate fingerprints:

 MD5:  D3:CA:6D:F4:5E:B6:E1:48:F1:D6:DB:C4:67:F5:C3:B2

 SHA1: 03:D8:EF:05:04:CF:06:86:15:1A:F1:D3:B1:18:46:xx:xx:xx:xx:xx

 Signature algorithm name: SHA1withRSA

 Version: 3

Take SHA1 key from List

Open your google api console and generate new key and give SHA1 key with your packagename

03:D8:EF:05:04:CF:06:86:15:1A:F1:D3:B1:18:46:F5:xx:xx:xx:xx;yourpackagename

Put the new map api key in your code.

Biraj Zalavadia
  • 28,348
  • 10
  • 61
  • 77
1

what i have used for SHA1 key isenter image description here

for debug key need to use from preference sha 1 finger print..

enter image description here

Shadow
  • 6,864
  • 6
  • 44
  • 93
madhu527
  • 4,644
  • 1
  • 28
  • 29
  • no need to go for this much procedure. very simple in eclipse. help->preference->build-> you can find /sha1 finger print for debug :) and for release when you export, the last procedure you can find shall finger print :) – Shadow Apr 14 '15 at 06:59
  • yeah your right . actually the above solution not worked for me. i have used while exporting signed apk in last screen it shows SHA1 & MD5 . i have used that SHA1 . am i right? – madhu527 Apr 14 '15 at 07:04
  • the problem is locally its not working . on Signed APK its working – madhu527 Apr 14 '15 at 07:20
  • yes you are right because for unsigned apk you need to use different sha1 – Shadow Apr 14 '15 at 07:59
  • signed apk works where everytime you need to export and check but unsigned apk ie from preference you don't want to export and check. it will run locally. but when you publish app alone, check whether you are using signed apk keystore orelse map will not loaded and looks blank. hope you got it :) – Shadow Apr 14 '15 at 08:03
  • thanq dude...my doubt is clarified – madhu527 Apr 14 '15 at 08:05
  • @Shadow keytool -list -alias MyAndroidKey -keystore C:\Users\myUser\.android\android.jks -storepass mystorepass -keypass mykeypass – iOSAndroidWindowsMobileAppsDev Aug 26 '16 at 11:25
0

Create release key for android map using the key you have used to create your release. It will work.

CodingRat
  • 1,934
  • 3
  • 23
  • 43
0

Just check your google_maps_key under the src/release directory, you should place there your own key from the google console (the one you got with the release fingerprint SHA1).

0

all this not help for me...

map works only then i get sha-1 cert directly from app on google play, send to my server, store and set up in cloud api key

Maps works fine from GooglePlay! ENJOY!

import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.Signature;
import android.util.Base64;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;

void getCertSHA1(){
        PackageInfo info;
        try {
            info = getPackageManager().getPackageInfo("ru.ispyco.example", PackageManager.GET_SIGNATURES);
            for (Signature signature : info.signatures) {
                MessageDigest md;
                md = MessageDigest.getInstance("SHA");
                md.update(signature.toByteArray());
                String sha1 = toHexString(md.digest());
                Log.i("sha-1: ",sha1);
                //send sha1 on your server HERE!
            }
        } catch (PackageManager.NameNotFoundException e1) {
            Log.i("name not found ", e1.toString());
        } catch (NoSuchAlgorithmException e) {
            Log.i("no such an algorithm", e.toString());
        } catch (Exception e) {
            Log.i("exception ", e.toString());
        }
    }

    private String toHexString(byte[] block) {
        StringBuffer buf = new StringBuffer();
        int len = block.length;
        for (int i = 0; i < len; i++) {
            byte2hex(block[i], buf);
            if (i < len - 1) {
                buf.append(":");
            }
        }
        return buf.toString();
    }

    private void byte2hex(byte b, StringBuffer buf) {
        char[] hexChars = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
        int high = ((b & 0xf0) >> 4);
        int low = (b & 0x0f);
        buf.append(hexChars[high]);
        buf.append(hexChars[low]);
    }