Halil Bilgin
Halil Bilgin

Reputation: 1

android mapview blank

I am trying to use Map Api v2 for few days but didn't have any success. Here is my code:

package com.example.turkceasistanim;

import android.os.Bundle;

import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;

public class MainActivity extends MapActivity  {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        MapView mapView = (MapView) findViewById(R.id.mapview);
        mapView.setBuiltInZoomControls(true);
    }

    @Override
    protected boolean isRouteDisplayed() {
        // TODO Auto-generated method stub
        return false;
    }
}

When I ran this application I got a blank map like this: https://i.sstatic.net/B7H4G.jpg

So what should I do ?

Upvotes: 0

Views: 1893

Answers (2)

Ryan Huang
Ryan Huang

Reputation: 31

This is due to your api key.

First you need to have the SHA-1 fingerprint of your application certificate. If you have not released your app, it is likely that you are using the debug certificate.

Find your certificate and use the keytool to obtain the SHA-1 fingerprint. Then obtain the Map API v2 key.

Guide can be found in the following link.

Getting the Google Maps Android API v2

Upvotes: 1

Arif Nadeem
Arif Nadeem

Reputation: 8604

How did you obtain your map key, did you use release key to sign your app keystore and then used it to obtain MD5 key?

If yes then you will have to sign your apk again with the same key to use it, or else you won't see the app just as in your case.

To do so export the app and sign it with the same password and keystore you used earlier.

Then copy the apk file on to your device and install it from there, it will work.

Or the best of all sign your app with debug keystore and run it directly from eclipse.

Upvotes: 0

Related Questions