Android Maps: Failed to load map. Could not contact Google servers

后端 未结 1 1711
挽巷
挽巷 2021-01-18 03:45

This bug has been persistent for forever. (I made sure that \"Google Maps Android API v2\" is the one turned on.)

Here\'s the MainActivity.java:

pack         


        
相关标签:
1条回答
  • 2021-01-18 04:03

    1. The first problem I see is here:

    <fragment 
    class="com.google.android.gms.maps.SupportMapFragment"
    android:id="@+id/map"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:name="com.google.android.gms.maps.MapFragment"/>
    

    remove this line: class="com.google.android.gms.maps.SupportMapFragment"

    and set android:name as:

     android:name="com.google.android.gms.maps.SupportMapFragment"
    

    2. Remove this line from the manifest file:

    <uses-library android:name="com.google.android.maps" />
    

    This is Google Maps API V1 permission and shouldn't be use in API V2.

    Take a look at this blog post and make sure are doing everything correctly:

    Google Maps API V2

    3. The problem you describing usually derives from a problem in generating or registering the API key using the API Console, If you are positive that you have made all the steps correctly then I suggest you to delete the debug.keystore folder, compile some project in Eclipse (this will result in a new SHA1 key) and register the key again using the console. Take a look at this blog post I wrote and make sure I are doing all the steps right:

    Google Map API V2 Key

    0 讨论(0)
提交回复
热议问题