Google Map Android API v2 can't display map in play store application
Asked Answered
D

6

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.

Denbighshire answered 23/8, 2013 at 5:58 Comment(4)
unsigned apk will not run into device untill you make signedSarver
I hope you make the finger sh1 with same keystore then it will work do not make with debug keystore.Sarver
ya @sunil you are right. i am create sha1 using debug.keystoreDenbighshire
and you make the apk with different keystore. that why you make with same keystore it will workSarver
B
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.

Belfast answered 23/8, 2013 at 6:2 Comment(9)
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.Leith
@HakunaMatata how to find release key ?Outpouring
@Outpouring above mentioned answer is release key.Belfast
@madhusudhan what issue? you need debug or release key?Belfast
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??Proto
you got SHA1 finger print? you need to use SHA1 and not MD5Belfast
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?Proto
@Outpouring keytool -list -alias MyAndroidKey -keystore C:\Users\myUser\.android\android.jks -storepass mystorepass -keypass mykeypassGagnon
can i able to see the map with releasae key in devices with out upload in playstoreCentrifugate
U
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.

Uphroe answered 23/8, 2013 at 6:14 Comment(2)
your answer is right but some other user give me answer first.+1 for youDenbighshire
@madhusudhan keytool -list -alias MyAndroidKey -keystore C:\Users\myUser\.android\android.jks -storepass mystorepass -keypass mykeypassGagnon
P
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

Proto answered 13/4, 2015 at 9:33 Comment(7)
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 :)Belfast
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?Proto
the problem is locally its not working . on Signed APK its workingProto
yes you are right because for unsigned apk you need to use different sha1Belfast
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 :)Belfast
thanq dude...my doubt is clarifiedProto
@Belfast keytool -list -alias MyAndroidKey -keystore C:\Users\myUser\.android\android.jks -storepass mystorepass -keypass mykeypassGagnon
M
0

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

Mannered answered 23/8, 2013 at 6:7 Comment(1)
i didnt get you. could you explain more?Proto
R
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).

Redness answered 26/11, 2015 at 20:57 Comment(0)
E
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]);
    }
Estienne answered 18/2, 2022 at 6:5 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.