Android: Google maps not showing

I am trying to get a google map to display. I see the background (light gray background, small tiles, the Google logo in the lower left corner), so I know that I'm close. However, the map is not displayed. In LogCat, I see this message repeating over and over:

05-14 13: 28: 17.926: W / System.err (27458): atroid_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestDispatcher $ DispatcherServer.run (DataRequestDispatcher.java:1702)

I am using Google maps api 2 with an attached phone for testing running 2.3.4.

Does anyone know what could be causing this? Thanks!

package com.example.maptest; import android.os.Bundle; import com.google.android.maps.MapActivity; import com.google.android.maps.MapController; import com.google.android.maps.MapView; public class MyMapActivity extends MapActivity { private MapView mapView; private MapController mapController; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.map_layout); mapView = (MapView)findViewById(R.id.map_view); } @Override protected boolean isRouteDisplayed() { return false; } } 

AndroidManifest.xml

 <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.maptest" android:versionCode="1" android:versionName="1.0" > <permission android:name="com.example.maptest.permission.MAPS_RECEIVE" android:protectionLevel="signature"/> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="com.example.maptest.permission.MAPS_RECEIVE"/> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-feature android:glEsVersion="0x00020000" android:required="true"/> <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17" /> <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <uses-library android:required="true" android:name="com.google.android.maps" /> <activity android:name="com.example.maptest.MyMapActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name=".MainActivity" > </activity> <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="xxxxxxxxxxxxxxxxxxxx"/> </application> </manifest> 
+10
source share
10 answers

This issue is usually related to the map API key used to sign the manifest. Take a look at this post and this one that describes the same error you are experiencing. In both cases, this is due to the fact that the API key used by him was created with the wrong keystore . You need to make sure that you use the debug repository when creating the API key in the Google API console, if you intend to test it from eclipse.

+15
source

Basically you mix the legacy Android v1 API with the new v2 API.

The easiest way to migrate is to remove all v1-related codes and start from scratch by following this link: https://developers.google.com/maps/documentation/android/start

+4
source

If you have several packages in the application, beware when creating the API key , you should use the package name included at the top of the android mainfest.xml file

 <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" **package="com.xxx.xxx"** android:versionCode="1" android:versionName="1.0" > 
+1
source

well, actually i have lived through this problem and it is going crazy. after i found a solution. very simple:

1- in your google_maps_api.xml project, just check the website link for your package name if your package name exists and is fixed. go to the page and get the key

To get one, follow this link, follow the directions and click "Create", at the end:

 https://console.developers.google.com/flows/enableapi?apiid=maps_android_backend&keyType=CLIENT_SIDE_ANDROID&r=... 

2- just create a new gooogle maps activity project, get the SHA-1 code.

Do not forget that the SHA-1 code is the same in your other project, but the web link is unique for each of your programs.

+1
source

go to the development console to display the api for your device and then copy your key and paste the values ​​→ google_maps_api.xml. It works. Use an Android key (automatically generated by google), if on Android devices.

+1
source

After several days of struggle, I found the problem. In my manifest, I had a key value stored in an XML file and it did not work. Now I have

 <meta-data android:name="com.google.android.geo.API_KEY" android:value="AIzxxxxxxxxxxxxxxxxxxxxxxxkey" /> and it works. 

Just deleted the xml file ... Hope this helps!

+1
source

I had the same problem. The problem was in my manifest file. Check if the Google Maps key you saved in the STRING.xml file and google maps in google_maps_api.xml does not have the same name.

0
source

One of the most likely reasons for this is because you did not add the API key to the project manifest file. The easiest way to fix this is to go to google_maps_api.xml, copy the link to the file and paste it into the browser. Click on the "Create" button in the link, copy the api key generated after that and paste it into the AndroidManifest.xml file instead of "Your Api Key", which is inside the metadata tag, compile a project that will fix the problem.

0
source

Perhaps this is due to the fact that because of the Google API key, you need to put the google_maps_api.xml file in the values ​​folder and insert the correct API key into it. and also you should put this code in the AndroidManifest.xml file

  <application> <meta-data android:name="com.google.android.geo.API_KEY" android:value="YOUR_API_KEY" /> </application> 
0
source

If all the answers do not work at all. Then use another emulator. It worked for me.

0
source

All Articles