-1

Is it possible to run the android map activity on the emulator? because I'm getting the error "this app won't run unless you update the Google play services"

My code is as follows :

MainActivity.java

 package com.example.googlev2map;
    import android.app.Activity;  
    import android.os.Bundle;  
    import android.support.v4.app.FragmentActivity;  
    public class MainActivity extends FragmentActivity {  
         @Override  
         protected void onCreate(Bundle arg0) {  
              // TODO Auto-generated method stub  
              super.onCreate(arg0);  
              setContentView(R.layout.activity_main);  
         }  }

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  
         android:id="@+id/fragment1"  
         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.example.googlev2map"
    android:versionCode="1"
    android:versionName="1.0" >
<uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="17" />
<permission
        android:name="com.example.googlev2map.permission.MAPS_RECEIVE"
        android:protectionLevel="signature"></permission>
    <uses-permission
        android:name="com.example.googlev2map.permission.MAPS_RECEIVE"/>
    <uses-permission
        android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
    <uses-permission
        android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission
        android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission
        android:name="android.permission.ACCESS_COARSE_LOCATION"/>
    <uses-permission
        android:name="android.permission.ACCESS_FINE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION" />
    <uses-feature
        android:glEsVersion="0x00020000"
        android:required="true"/>

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.example.googlev2map.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="AIzaSyAy2ThskwG3Q9ArpZR_GvJP5_5IWfcEJhU"/>
         <meta-data android:name="com.google.android.gms.version" 
            android:value="@integer/google_play_services_version" />

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

    </application>

</manifest>
halfer
  • 19,824
  • 17
  • 99
  • 186
user3194074
  • 21
  • 1
  • 5

1 Answers1

0
 this app wont run unless you update the Google play services

Google map requires google play services.

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

  1. A compatible Android device that runs Android 2.3 or higher and includes Google Play Store.

  2. The Android emulator with an AVD that runs the Google APIs platform based on Android 4.2.2 or higher.

So if you still get the message "this app wont run unless you update the Google play services" it is clear that the device on which you are trying to run does not have google play services installed. So you need to test on a real device that has google play servies installed

Raghunandan
  • 132,755
  • 26
  • 225
  • 256