This app won't run unless you update Google Play services error

78,190

Solution 1

In the Android SDK Manager, you must install "Google APIs (x86 System Image)" under "Android 4.4.2 (API 19)". Quit Eclipse and restart it.

Then create a new android virtual device in AVD manager and choose "Google APIs x86 (Google Inc.) - API Level 19" as target. Check "Use Host GPU" to ensure the drawing of the map will be accelerated.

That's it, this new emulator will have Play Services preinstalled and it will run faster because it's a x86 image.

Solution 2

using android studio, the only thing that helped me was to reduce the google play services version in the gradle file from the last version to this:

compile 'com.google.android.gms:play-services:4.2.+'

(ofcourse,this is a temporary "bypass" to enable you continue running)

Solution 3

I had a problem getting this error and hitting the 'Update' button did nothing, it was stuck on a loop, what worked is the following (in Android Studio):

  • Go to Tools > Android > SDK Manager
  • Check the 'Show Package Details' option
  • Under the Android version you want (7.1.1 for me right now), check Google Play Intel x86 Atom System Image google play intel atom system image
  • Hit Apply/OK and let the image install
  • Now go to Tools > Android > AVD Manager
  • Create Virtual Device
  • Select one of the devices with a Google Play logo: devices with a Google Play logo
  • Run your app in the new emulator. You can now hit 'Update' when you get the error, update Google Play Services via the Play Store on your device, and test your app in peace.

Solution 4

While the provided answers will work for an emulator, this could be a real issue on a real device and these solutions will not work on a real device. This could happen on an old device that has an outdated version of Google Play Services.

To overcome this issue, the Google Play Services library has a set of APIs to check the availability of Google Play Services, mainly the GoogleApiAvailability class provides a few methods to handle availability issues such as an outdated version.

Now, to detect whether a device has Google Play Services available or not, what I normally do is create a helper method to run the check

private boolean checkPlayServices(){
    GoogleApiAvailability gaa = GoogleApiAvailability.getInstance();
    int result = gaa.isGooglePlayServicesAvailable(getApplicationContext());

    if(result != ConnectionResult.SUCCESS){
        if(gaa.isUserResolvableError(result)){
            gaa.getErrorDialog(this,result, REQUEST_PLAY_SERVICES_RESOLUTION).show();
        }

        return false;
    }

    return true;
}

This helper method checks whether Google Play Services is available or not by inspecting the error code returned from isGooglePlayServicesAvailable. Then it calls isUserResolvableError to determine if the error is resolvable by the user (e.g. by updating Google Play Services). If it is resolvable, then a dialog is displayed for the user to confirm he wants the system to resolve the error. Then call it on the Activity's onCreate method, I run that check as below

//I normally assume Google Play services is available
private boolean playServicesAvailable = true;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_map_selector);

    //check for rare case where Google Play Services is not available
    playServicesAvailable = checkPlayServices();

    if(!playServicesAvailable){
        //hide UI elements and turn off features that rely on Google Play Services
    }
}

Hope it helps some out there

Solution 5

To save yourself the trouble of configuring an emulator that does not have google play support,always use an emulator with the playicon enter image description here

as depicted in the image:The play icon present under the Playstore row.

enter image description here

After installing the google play compatible emulator...run your app in the emulator again...and when you get the notification"App wont run unless......"click on the notification and follow the screen prompts:"Signing In using a gmail account...email and password etc",as soon as you agree to the google licence youl get the google play update screen: enter image description here

update your google play and launch your app again. Also make sure you have the google dependencies in your app level gradle and gradle:

App level gradle build.gradle(Module:app)

dependencies {

}

    apply plugin: 'com.google.gms.google-services'

Project level Gradle "build,gradle(Project:AppName)"

dependencies {

    classpath 'com.google.gms:google-services:3.2.1'
}
Share:
78,190

Related videos on Youtube

Florent Gz
Author by

Florent Gz

Updated on July 09, 2022

Comments

  • Florent Gz
    Florent Gz almost 2 years

    I'm kind of lost right now. I'm implementing an Android application using Google maps.

    In order to make it work I followed some tutorials which were pretty efficient. However I'm stuck with this ":

    enter image description here

    To fix, this problem I found some tricks here or here which tell that to solve this issue you have to take a special configuration for the emulator, here is mine:

    enter image description here

    and to install some .apk on the emulator.

    enter image description here

    And the magic is supposed to be done and the map is supposed to appear which is not my case.

    I checked that my extras were well installed:

    enter image description here

    Here is my AndroidManifest:

    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
              package="mypack"
              android:versionCode="1"
              android:versionName="1.0">
    
        <uses-sdk android:minSdkVersion="16"/>
    
        <permission android:name="mypack.permission.MAPS_RECEIVE"
                    android:protectionLevel="signature"/>
        <uses-permission android:name="mypack.permission.MAPS_receive"/>
    
        <!-- Permission pour utiliser la connexion internet -->
        <uses-permission android:name="android.permission.INTERNET" />
        <!-- Permission permettant de vérifier l'état de la connexion -->
        <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
        <!-- Permission pour stocker des données en cache de la map -->
        <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" />
    
        <application android:label="@string/app_name" android:icon="@drawable/ic_launcher">
            <meta-data
                    android:name="com.google.android.maps.v2.API_KEY"
                    android:value="MYKEY" />
    
            <meta-data android:name="com.google.android.gms.version"
                       android:value="@integer/google_play_services_version" />
    
            <activity android:name="Home"
                      android:label="@string/app_name">
                <intent-filter>
                    <action android:name="android.intent.action.MAIN"/>
                    <category android:name="android.intent.category.LAUNCHER"/>
                </intent-filter>
            </activity>
        </application>
    
    </manifest>
    

    Here is my MainActivity

    import android.app.Activity;
    import android.os.Bundle;
    import com.google.android.gms.maps.GoogleMap;
    import com.google.android.gms.maps.MapFragment;
    
    public class Home extends Activity {
        /**
         * Called when the activity is first created.
         */
        private GoogleMap map;
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main);
            map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
        }
    }
    

    and the corresponding layout:

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
                  android:orientation="vertical"
                  android:layout_width="fill_parent"
                  android:layout_height="fill_parent"
            >
        <fragment xmlns:android="http://schemas.android.com/apk/res/android"
                  android:id="@+id/map"
                  android:name="com.google.android.gms.maps.MapFragment"
                  android:layout_width="match_parent"
                  android:layout_height="match_parent" />
    </LinearLayout>
    

    Hope to find some fix or what I missed here, thank you in advance.

    • Jorge Y. C. Rodriguez
      Jorge Y. C. Rodriguez about 10 years
    • Florent Gz
      Florent Gz about 10 years
      The fact is I follow the steps which are supposed to fix this error but nothing worked for me. So I was wondering what I may have missed
    • Jorge Y. C. Rodriguez
      Jorge Y. C. Rodriguez about 10 years
      them you question is a bit missleading, since that error is cause it by trying to run a GPS app in the emulator, either way this stackoverflow.com/questions/2279647/… it may help you
    • Florent Gz
      Florent Gz about 10 years
      Right now I'm not sure that I'm using the GPS just trying to display a random map.
  • Fidel
    Fidel almost 9 years
    Out of all the things I tried (running different devices with different os images), this is the one that finally worked! thanks
  • Ray Kiddy
    Ray Kiddy almost 9 years
    Any idea how to get an emulator with Play installed using the ADK? It should be possible, but I do not see it....
  • Husnain Iqbal
    Husnain Iqbal almost 9 years
    It runs for Lollipop (Android 5.1.1) but does not for JelliBeans (Android 4.2). Please someone explain the logic behind this code and what if I want to run the app on JellyBeans and even smaller versions of android Apis. Thnaks
  • Omer
    Omer over 7 years
    If you want to compile with this version compile 'com.google.android.gms:play-services:9.4.0' then you should use emulator with API level 24