Google Play Services missing on Android 2.2 emulator while using Google Maps API v2
Asked Answered
W

8

4

Hey I am trying to use Google Maps on my emulator even though I've installed Google Play Services library when I run the app it says

This app won't run without Google Play Services which are missing from your phone

on LogCat I get the warning about it but not really sure why I am getting this.

my MainActivity.java

package com.mapsmaps;

import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.Menu;

import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.SupportMapFragment;

public class MainActivity extends FragmentActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        GoogleMap mapa = ((SupportMapFragment) getSupportFragmentManager()
                .findFragmentById(R.id.map)).getMap();

    }

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

activity_main.xml

<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
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/map"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        class="com.google.android.gms.maps.SupportMapFragment" />

</RelativeLayout>

AndroidManifest.xml

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

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

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

    <uses-permission android:name="com.mapsmaps.permission.MAPS_RECEIVE" />

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

    <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.mapsmaps.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="AIzaSyBdbj4iXi0SijKjJDrJw5RigtSpQcaID7Q" />
    </application>

</manifest>

LogCat -

D/dalvikvm(451): DexOpt: couldn't find field 
    Landroid/content/res/Configuration;.smallestScreenWidthDp
W/dalvikvm(451): VFY: unable to resolve instance field 24
D/dalvikvm(451): VFY: replacing opcode 0x52 at 0x0012
D/dalvikvm(451): VFY: dead code 0x0014-0018 in 
    Lcom/google/android/gms/common/GooglePlayServicesUtil;.b 
    (Landroid/content/res/Resources;)Z
W/GooglePlayServicesUtil(451): Google Play services is missing.
W/GooglePlayServicesUtil(451): Google Play services is missing.
W/GooglePlayServicesUtil(451): Google Play services is missing.
W/GooglePlayServicesUtil(451): Google Play services is missing.
W/GooglePlayServicesUtil(451): Google Play services is missing.
W/GooglePlayServicesUtil(451): Google Play services is missing.
W/GooglePlayServicesUtil(451): Google Play services is missing.

library screenshot

emulator screenshot

Wax answered 31/1, 2013 at 9:21 Comment(0)
L
2

"To test your app when using the Google Play services SDK, you must use The Android emulator with an AVD that runs the Google APIs platform based on Android 4.2.2 or higher."

From http://developer.android.com/google/play-services/setup.html

Legal answered 13/8, 2013 at 22:6 Comment(0)
D
2

To test your app when using the Google Play services SDK, you must use either:

A compatible Android device that runs Android 2.3 or higher and includes Google Play Store. The Android emulator with an AVD that runs the Google APIs platform based on Android 4.2.2 or higher.

Diarmid answered 4/3, 2014 at 18:14 Comment(0)
B
1

Please check the link http://developer.android.com/google/play-services/setup.html

there is clearly mentioned that you must provide a physical development device on which you can run and debug your app.

Note: Google Play services is not supported on the Android emulator — to develop using the APIs, you need to provide a development device such as an Android phone or tablet.

Burnside answered 13/3, 2013 at 12:46 Comment(2)
So Location Controls in Emulator is useless! :jCrespi
That's not true. The webpage must have changed.Hurry
U
0

As of now Google Maps V2 are not going to be displayed on Emulators. They will be running only on Real Time Devices which have play store app installed. Test the Application that having Google Maps V2 only on Real time device and not Emulators. There is no other alternative also as of now.

Usia answered 31/1, 2013 at 9:27 Comment(2)
I've seen guides that help people using google maps api v2 on their android emulators.however none of those helped me. also I've Maps app installed default on my emulator which is actually working (probably version 1)Wax
@Rodrane I don't know how that is possible but as far as I know that is not possible. I tried and failed to get the display on Emulators. As of now I will do all my testing of Google Maps V2 on Device only.Usia
G
0

Google Maps V2 isn't meant to work on an emulator since it is bundled with the Google Play Services.

If you're still wondering how to make it work on the emulator, you might want to give this blog post and SO answer a read. As pointed out by CommonsWare, the tweaks listed in these article boil down to pirating software. If you're really thinking about developing on Android, you might wanna consider buying a device.

Grenoble answered 31/1, 2013 at 9:32 Comment(0)
D
0

I've faced this problem before. The reason is your google play is work on your emulator. Try this to install google play to your emulator

Djokjakarta answered 31/1, 2013 at 9:44 Comment(0)
W
0

You can check this blog post I wrote on how to run Google Maps API V2 on the emulator:

Emulator speed-up and Google Map API V2

It is an information that I found here on SO in one of the posts.

Wirehaired answered 25/3, 2013 at 14:32 Comment(0)
S
0

Start the SDK manager and install the Google API images (are currently 2). Then create an AVD based on either of them. You should be good to go :)

Siam answered 4/6, 2014 at 20:7 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.