I have been following Android SDK: Working with Google Maps - Application Setup to making an app display google map. I have followed many tutorials, but always end up with the same error! I have also searched around the web and figured my error is something to do with the "fragment". Here are my files:
MyMapActivity.java
package com.klmeet.googlemap;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
public class MyMapActivity extends FragmentActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_my_map);
}
}
activity_my_map.xml
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
android:id="@+id/the_map"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:name="com.google.android.gms.maps.MapFragment"
map:cameraTilt="45"
map:cameraZoom="14"
/>
Manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.klmeet.googlemap"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="17" />
<permission android:name="com.klmeet.googlemap.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="com.klmeet.googlemap.permission.MAPS_RECEIVE"/>
<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="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:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MyMapActivity"
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="AIzaSyA2IXP7WH1ErmQiUencYu0syPQqq9mAgeA" />
</application>
</manifest>
That s my LogCat
06-05 03:44:50.891: E/AndroidRuntime(31357): FATAL EXCEPTION: main
06-05 03:44:50.891: E/AndroidRuntime(31357): Process: com.klmeet.googlemap, PID: 31357
06-05 03:44:50.891: E/AndroidRuntime(31357): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.klmeet.googlemap/com.klmeet.googlemap.MyMapActivity}: android.view.InflateException: Binary XML file line #1: Error inflating class fragment
06-05 03:44:50.891: E/AndroidRuntime(31357): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2316)
06-05 03:44:50.891: E/AndroidRuntime(31357): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2376)
06-05 03:44:50.891: E/AndroidRuntime(31357): at android.app.ActivityThread.access$800(ActivityThread.java:147)
06-05 03:44:50.891: E/AndroidRuntime(31357): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1281)
06-05 03:44:50.891: E/AndroidRuntime(31357): at android.os.Handler.dispatchMessage(Handler.java:102)
06-05 03:44:50.891: E/AndroidRuntime(31357): at android.os.Looper.loop(Looper.java:135)
06-05 03:44:50.891: E/AndroidRuntime(31357): at android.app.ActivityThread.main(ActivityThread.java:5253)
06-05 03:44:50.891: E/AndroidRuntime(31357): at java.lang.reflect.Method.invoke(Native Method)
06-05 03:44:50.891: E/AndroidRuntime(31357): at java.lang.reflect.Method.invoke(Method.java:372)
06-05 03:44:50.891: E/AndroidRuntime(31357): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:948)
06-05 03:44:50.891: E/AndroidRuntime(31357): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:743)
06-05 03:44:50.891: E/AndroidRuntime(31357): Caused by: android.view.InflateException: Binary XML file line #1: Error inflating class fragment
06-05 03:44:50.891: E/AndroidRuntime(31357): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:763)
06-05 03:44:50.891: E/AndroidRuntime(31357): at android.view.LayoutInflater.inflate(LayoutInflater.java:482)
06-05 03:44:50.891: E/AndroidRuntime(31357): at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
06-05 03:44:50.891: E/AndroidRuntime(31357): at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
06-05 03:44:50.891: E/AndroidRuntime(31357): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:377)
06-05 03:44:50.891: E/AndroidRuntime(31357): at android.app.Activity.setContentView(Activity.java:2186)
06-05 03:44:50.891: E/AndroidRuntime(31357): at com.klmeet.googlemap.MyMapActivity.onCreate(MyMapActivity.java:13)
06-05 03:44:50.891: E/AndroidRuntime(31357): at android.app.Activity.performCreate(Activity.java:5975)
06-05 03:44:50.891: E/AndroidRuntime(31357): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
06-05 03:44:50.891: E/AndroidRuntime(31357): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2269)
06-05 03:44:50.891: E/AndroidRuntime(31357): ... 10 more
06-05 03:44:50.891: E/AndroidRuntime(31357): Caused by: java.lang.IllegalStateException: The meta-data tag in your app's AndroidManifest.xml does not have the right value. Expected 7571000 but found 0. You must have the following declaration within the <application> element: <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
06-05 03:44:50.891: E/AndroidRuntime(31357): at com.google.android.gms.common.GooglePlayServicesUtil.zzaa(Unknown Source)
06-05 03:44:50.891: E/AndroidRuntime(31357): at com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable(Unknown Source)
06-05 03:44:50.891: E/AndroidRuntime(31357): at com.google.android.gms.maps.internal.zzy.zzaz(Unknown Source)
06-05 03:44:50.891: E/AndroidRuntime(31357): at com.google.android.gms.maps.internal.zzy.zzay(Unknown Source)
06-05 03:44:50.891: E/AndroidRuntime(31357): at com.google.android.gms.maps.MapsInitializer.initialize(Unknown Source)
06-05 03:44:50.891: E/AndroidRuntime(31357): at com.google.android.gms.maps.MapFragment$zzb.zzvu(Unknown Source)
06-05 03:44:50.891: E/AndroidRuntime(31357): at com.google.android.gms.maps.MapFragment$zzb.zza(Unknown Source)
06-05 03:44:50.891: E/AndroidRuntime(31357): at com.google.android.gms.dynamic.zza.zza(Unknown Source)
06-05 03:44:50.891: E/AndroidRuntime(31357): at com.google.android.gms.dynamic.zza.onInflate(Unknown Source)
06-05 03:44:50.891: E/AndroidRuntime(31357): at com.google.android.gms.maps.MapFragment.onInflate(Unknown Source)
06-05 03:44:50.891: E/AndroidRuntime(31357): at android.app.FragmentManagerImpl.onCreateView(FragmentManager.java:2115)
06-05 03:44:50.891: E/AndroidRuntime(31357): at android.app.Activity.onCreateView(Activity.java:5324)
06-05 03:44:50.891: E/AndroidRuntime(31357): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:733)
06-05 03:44:50.891: E/AndroidRuntime(31357): ... 19 more
And i belive i contain all libs that i need.
I run it on my 5.0.1 android device
Where is this google play service integration?