Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failed to load map. Error contacting Google servers on fragment

  1. I google two days and still this message. I use debug key to debug on my nexus 7.
  2. I don't know where is wrong. I have right key,open right api access
  3. but google map on my tablet still blank.

MapsFragment:

    public View onCreateView(LayoutInflater inflater, ViewGroup container,

Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.map_fragment,container, false); container.removeAllViews(); map = ((SupportMapFragment)getActivity() .getSupportFragmentManager() .findFragmentById(R.id.map)) .getMap(); map.setMyLocationEnabled(true); map.setMapType(GoogleMap.MAP_TYPE_NORMAL);

   mMapFragment = SupportMapFragment.newInstance();
   FragmentTransaction fragmentTransaction = 

getChildFragmentManager().beginTransaction();
fragmentTransaction.add(R.id.map,mMapFragment);
fragmentTransaction.commit(); return rootView; }

Manifest:

<uses-sdk
    android:minSdkVersion="14"
    android:targetSdkVersion="16" />

<!-- Google Map -->   <permission
      android:name="com.jertt.xxx.permission.MAPS_RECEIVE"
      android:protectionLevel="signature"/>
<uses-permission android:name="com.jertt.yummymap.permission.MAPS_RECEIVE"/>

<!-- end -->

<uses-feature
    android:glEsVersion="0x00020000"
    android:required="true" />

<!-- end -->
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name="com.jertt.yummymap.MainActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

    <!-- Google Map API Key -->

    <meta-data
        android:name="com.google.android.maps.v2.API_KEY"
        android:value="AIzaSyB54eZnUp8Sw*****" />

    <!-- end -->
</application>

map_fragment.xml

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

like image 795
JackWu Avatar asked Dec 31 '25 04:12

JackWu


1 Answers

Not sure if this is your problem or not, but I spend a TON of time trying to figure this one out. Checking the permissions, regenerating api keys. Finally saw a small comment in another answer that worked for me.

Rename your debug.keystore file and then do a clean, and then build. this will generate a new debug.keystore. and a new SHA1 fingerprint. Plug that new fingerprint into the api console and try again.

The other thing you can check is to look at the "reports" section of the api console for the project you are trying to access the api from. If you have tried to run your project and have no traffic for that api, chances are either the SHA1 fingerprint or the package name you gave is wrong. In my case it was the fingerprint.

like image 167
nPn Avatar answered Jan 02 '26 20:01

nPn