0

I have gone through all the required setups for Google play. But my emulator inside eclipse giving me error "Unfortunately your com.vogella.. ..stopped" please suggest me solutions so that I can check my sample code for google map is working or not.

My ShowMapActivity.java file

package com.vogella.android.locationapi.maps;

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;

import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapFragment;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;

@SuppressWarnings("unused")
public class ShowMapActivity extends Activity {
static final LatLng HAMBURG = new LatLng(53.558, 9.927);
static final LatLng KIEL = new LatLng(53.551, 9.993);
private GoogleMap map;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_show_map);
map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map))
    .getMap();
// Move the camera instantly to hamburg with a zoom of 15.
map.moveCamera(CameraUpdateFactory.newLatLngZoom(HAMBURG, 15));

// Zoom in, animating the camera.
map.animateCamera(CameraUpdateFactory.zoomTo(10), 2000, null);
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.show_map, menu);
return true;
}

} 

My activity_show_map xml file

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >

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

</RelativeLayout> 


AnrdoidManifest.xml file

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.vogella.android.locationapi.maps"
android:versionCode="1"
android:versionName="1.0" >

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

<permission
    android:name="com.vogella.android.locationapi.maps.permission.MAPS_RECEIVE"
    android:protectionLevel="signature" />

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

<uses-permission          android:name="com.vogella.android.locationapi.maps.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:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.vogella.android.locationapi.maps.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>

    <meta-data
        android:name="com.google.android.maps.v2.API_KEY"
        android:value="AIzaSyBIVouPmUMc0-EDPtQwqgzVcwlEt9NlaIo" />
</application>

Ariel Magbanua
  • 3,083
  • 7
  • 37
  • 48

4 Answers4

0

Google Maps for Android v2 API doesn't run in emulator out-of-the box. There are some people who got it working with some tricks, but I myself unfortunately didn't.

You can work through this post to try it yourself, good luck! ... or use a real device.

Community
  • 1
  • 1
Matt Handy
  • 29,855
  • 2
  • 89
  • 112
0

Even i didnt have any luck running the maps on an emulator . But on a real device it should work fine.

There are some steps here.. Hope it helps

Some Synopsis

Installing google service packages; gms and vending

Be sure that emulator started Copy attached com.google.android.gms-19032013.apk and com.google.android.vending-19032013.apk files to <bundel root>\sdk\platform-tools
    Open command from and go to <bundel root>\sdk\platform-tools
    then run command adb install com.google.android.gms-19032013.apk


then run command adb install com.android.vending-19032013.apk
if it says already exits then run commands
    adb uninstall com.android.vending
    adb uninstall com.google.android.gms

Guess this would Help :)

Benil Mathew
  • 1,638
  • 11
  • 23
  • Note that link-only answers are discouraged here on SO. Please consider [editing your answer](http://meta.stackexchange.com/a/8259/186599) and adding a synopsis here. – Nazik Jun 18 '13 at 06:15
0

According to this link: http://developer.android.com/google/play-services/setup.html. Your emulator has to be running Google APIs 4.2.2 or higher.

rw.liang1
  • 418
  • 4
  • 12
0

I have tried to run an app which use google play service on emulator and it works

first of all create Android Emulator with api level 18 (Android 4.3)

the you have to download two APK :

1) Google play APK named com.android.vending.apk (seek for the latest version)

2) Google play service named com.google.android.gms.apk (seek for the latest version)

then install those two apk in your emulator that you just created :

open your console then go to platform-tools file of your SDK

write those command to insatall apk

adb install com.android.vending.apk

then

adb install com.android.vending.apk

Restart your adb with this command

adb restart

launch your app hope that it work

Netero
  • 3,761
  • 2
  • 29
  • 29