"Fatal Exceptions: Essential" and "Google Play Services Deprecated" on the emulator

I am new to Android and I am trying to develop an Android application that includes google maps. The app worked fine on the emulator until I decided to update Google Play Services from version 7 to 9.

Now I get the same error that I ran into before ("Google Play services are out of date ...") and also a "fatal exception: major" error. This is what I get in logcat:

http://imageshack.us/a/img11/8117/y1mq.png

If I read the logcat correctly, the error is listed in MapTabActivity, but I don't know if the error is due to Google Play services being out of date or something ...

Before updating Google Play services, the app was working on an emulator with

  • Nexus 4 device
  • Android 4.2.2 (API lvl 17)
  • ARM CPU
  • GPU host selected

I also had to install com.android.vending.apk and com.google.android.gms.apk which have been recommended in other posts about this.

I also added the permission required by the manifest and applied it to the API key, which is also included in the manifest.

Can anyone help me? Here's MapTabActivity and the corresponding XML.

MapTabActivity.java

package com.dissertation.closethedoordiss;

import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;

import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.View;

public class MapTabActivity extends FragmentActivity {

private GoogleMap mMap;
private static final LatLng BRISTOL = new LatLng(51.455083,-2.586903);

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


    mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.mapView)).getMap();
    mMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);

    mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(BRISTOL, 13));
}

public void onClick_addretailer (View view) {
    startActivity(new Intent("com.closethedoordiss.AddRetailerActivity"));
}  
}

      

activity_maptab.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:map="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

  <fragment
        android:name="com.google.android.gms.maps.SupportMapFragment" 
        android:id="@+id/mapView"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />



  <ImageButton
        android:id="@+id/imageButton1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:src="@android:drawable/ic_menu_add"
        android:onClick="onClick_addretailer"
        android:contentDescription="@string/add_button" />

</RelativeLayout>

      

Thanks in advance for the help provided.

+1


source to share


2 answers


The only way to find Google Maps Android API v2 is with a physical device.

I run my app on a Samsung Galaxy S Duos with Android 4.0.4 and the map is displayed correctly.



After several solutions, including testing multiple emulator configurations and installing different apks, I find the easiest way to overcome the "Google Play Services - Deprecated" issue when it comes to using the Google Maps API v2 on the emulator is by developing / testing on a physical device.

Hope it helps.

+1


source


I have had this problem many times and have found a couple of ways to solve it. Chances are, the Replay Services that your app is linking to doesn't match what you have on your device, which in this case is an emulator. This can happen because Google Play (or Google Play Services) is not installed on the emulator. Check out this post for more information . ... If it is installed, you may need to update it. You can update it by installing from scratch if the built-in update doesn't work.

If you are using Google Play Services as your library project, you may need to update your Google Play Services library. That's what I'm doing:

  • Open SDK Manager and see if there is an update for Google Play Services.
  • If there is, download it
  • In eclipse, delete the old Services project and import the new one.
  • Re-add the new project as reference


If you are not using Google Play Services as a library project or if you have updated alaready, then ignore everything I said above :)

Once your device / emulator and Eclipse project are using the same updated version of the Services library, then you should be good to go!

0


source







All Articles