1

I am able to ZOOM IN and ZOOM OUT, and I am also able to put an icon marker, but the problem is that the Map doesn't appear, all I can see is a GRID.. What's supposed to be the problem here? Does this involved the Google Maps API?

myooomyoo
  • 135
  • 2
  • 5
  • 15

4 Answers4

1

I got finally map in my emulator. I followed these steps to achieve it.

  1. Create avd and start emulator

  2. Go to platform tools path present in Android SDK and put these apk's in it.

    • com.android.vending-20130716
    • com.google.android.gms-20130716
  3. Install these apk's one by one by going to platform tools path by using command prompt(shift+Right click-->open command window here).Follow these commands
    • adb devices
    • adb install com.android.vending-20130716
    • adb install com.google.android.gms-20130716
  4. Import google-play-services_lib project which is present at project location and add it to your project.
  5. Restart emulator and clean your project and run it through emulator.

That's it. :) you can download above apk's from following link

Running Google Maps v2 on the Android emulator

enter image description here

Community
  • 1
  • 1
Shailendra Madda
  • 20,649
  • 15
  • 100
  • 138
0

try to add meta tag of goolge play services..

<meta-data
    android:name="com.google.android.gms.version"
    android:value="@integer/google_play_services_version" />
vinay Maneti
  • 1,447
  • 1
  • 23
  • 31
0

See here: Running Google Maps v2 on the Android emulator

Emulators don't like the v2 of google maps. Test on a real device if the map stays grey. If it does, your signing keys will most likely be misconfigured. Make sure that you also have you develop key registered on the Google API console.

Community
  • 1
  • 1
meredrica
  • 2,563
  • 1
  • 21
  • 24
0

this is in my Android Manifest

<?xml version="1.0" encoding="utf-8"?>

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.android.cmumap"
  android:versionCode="1"
  android:versionName="1.0">

<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="15" />

<permission
    android:name="com.android.cmumap.permission.MAPS_RECEIVE"
    android:protectionLevel="signature" />

<uses-permission android:name="com.android.cmumap.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" />

<application android:icon="@drawable/ic_launcher" android:label="@string/app_name">

    <activity android:name=".MainActivity"
              android:label="@string/app_name">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>

    <meta-data
    android:name="com.google.android.maps.v2.API_KEY"
        android:value="my API key"/>

    </activity>

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

    <meta-data
        android:name="com.google.android gms.version"
        android:value="@integer/google_play_services_version"/>

</application>

</manifest>

for the Main Activity, I have these

package com.android.cmumap;

import java.util.List;

import android.graphics.drawable.Drawable;
import android.os.Bundle;

import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapController;
import com.google.android.maps.MapView;
import com.google.android.maps.Overlay;
import com.google.android.maps.OverlayItem;

public class MainActivity extends MapActivity {

private MapView mapView;

private static final int latitudeE6 = 37985339;
private static final int longitudeE6 = 23716735;

@Override
public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    mapView = (MapView) findViewById(R.id.map_view);       
    mapView.setBuiltInZoomControls(true);

    List mapOverlays = mapView.getOverlays();
    Drawable drawable = this.getResources().getDrawable(R.drawable.ic_launcher);
    CustomItemizedOverlay itemizedOverlay = 
         new CustomItemizedOverlay(drawable, this);

    GeoPoint point = new GeoPoint(latitudeE6, longitudeE6);
    OverlayItem overlayitem = 
         new OverlayItem(point, "Hello", "I'm in Athens, Greece!");

    itemizedOverlay.addOverlay(overlayitem);
    mapOverlays.add(itemizedOverlay);

    MapController mapController = mapView.getController();

    mapController.animateTo(point);
    mapController.setZoom(6);

}

@Override
protected boolean isRouteDisplayed() {
    return false;
}

}

and this of the activity_main

<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout 
 xmlns:android="http://schemas.android.com/apk/res/android"
 android:orientation="vertical" 
 android:layout_width="fill_parent"
 android:layout_height="fill_parent">

 <com.google.android.maps.MapView
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/map_view"
  android:layout_width="fill_parent" 
  android:layout_height="fill_parent"
  android:clickable="true" 
  android:enabled="true" 
  android:apiKey="my API Key" />

</RelativeLayout>
myooomyoo
  • 135
  • 2
  • 5
  • 15