I am new to Android and I am trying to develop an android app that includes Google maps. The app was working fine on the emulator until I decided to update the Google Play services from revision 7 to 9.
I now get the same error I encountered before ("Google Play services is out of date..."), plus a "fatal exception: main" error. Here is what I get in the logcat:
http://imageshack.us/a/img11/8117/y1mq.png
If I read the logcat correctly, the error is in the MapTabActivity but I don't know if the error is caused by the Google Play services being out of date or if it's something else...
Before updating the Google Play services, the app was working on an emulator with
- Nexus 4 device
- Android 4.2.2(API lvl 17)
- ARM CPU
- Host GPU selected
I also had to install the com.android.vending.apk and com.google.android.gms.apk that was recommend in other posts about this.
I also added the permission necessary to the manifest and applied for an API key which is also included in the manifest.
Can anyone help me? Here's the MapTabActivity and its 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 any help provided.