Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: Google Maps not displaying

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

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

I'm using Google maps api 2 with a tethered phone for testing that is running 2.3.4.

Anyone know what might 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>
like image 559
AndroidDev Avatar asked May 14 '13 19:05

AndroidDev


1 Answers

go to developper console enable maps api for your device and then copy your key and paste in values->google_maps_api.xml . It works Use Android key(auto created by google service) if on android devices

like image 84
Vageesha Km Avatar answered Sep 17 '22 02:09

Vageesha Km