Search code examples
javaandroidgoogle-maps-api-2

How can I show GoogleMap v2 on Android


I tried to show GoogleMap v2 in my Android application,but it failed. Application didn't exit but I can't see GoogleMap on display as following image. I got API key and set it in Android Manifest, and I did other settings for using GoogleMap v2. For example, I added 7 permissions, 1 users-feature, 2 meta-data in Manifest.

Now I did nothing in MainActivity.java.(Just try to show main view.)

Is something missing for using it? Is there anyone who has experience like this? Please teach me how.

And I compiled it by Google API[Android 4.2.2]

Image URL : https://dl.dropboxusercontent.com/u/88565794/2014-02-07%2023.15.21.png


Solution

  • Have a look at this blog post, that describes almost the same problem: http://android-er.blogspot.nl/2012/12/google-maps-android-api-v2-with-blank.html

    If you use Google Maps Android API v2, but with a blank (gray) map displayed, and "E/Google Maps Android API(12676): Authorization failure" reported in LogCat; may be caused by a wrong API Key assigned.

    In order to use Maps Android API, you have to assign a API Key in AndroidManifest.xml.
    
         <meta-data
             android:name="com.google.android.maps.v2.API_KEY"
             android:value="your API Key here"/>
    

    But there are many more sources availble that describe a similar problem: https://www.google.co.uk/search?q=google+maps+v2+blank+map&client=safari

    Ofcourse I can't tell you what you did wrong, but I would suggest you take a tutorail like this one: http://www.androidhive.info/2013/08/android-working-with-google-maps-v2/ It even provides some how-to's on customization.

    Or have a look at the documentation: https://developers.google.com/maps/documentation/android/start