0

Hi I'm trying to use the Google Maps Api for my App and I only want to show the map but my logcat says this:

11-19 14:40:51.679: E/ActivityThread(18815): Failed to inflate
11-19 14:40:51.679: E/ActivityThread(18815): android.view.InflateException: Binary XML file line #2: Error inflating class fragment

here is the full logcat: http://wrttn.in/e7f3bc

This is my activity_main.xml

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

And this is my manifest:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.mapps"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="17" />

<uses-feature
    android:glEsVersion="0x00020000"
    android:required="true"/>

<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"/>
<!-- The following two permissions are not required to use
 Google Maps Android API v2, but are recommended. -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name="com.example.mapps.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="**key**"/>
</application>

And my MainActiviy.java doesn't have any extra code Please if someone know where the problem is I'll be grateful

German Katz
  • 53
  • 1
  • 8

1 Answers1

0

Instead of:

android:name="com.google.android.gms.maps.MapFragment"

Try this:

class="com.google.android.gms.maps.MapFragment" 

See: MapFragment Class Documentation

And check you have been already set Google Play Service as library in your project. You can do it like this: Setup Google Play Services in library

You can read this answer to help you: https://stackoverflow.com/a/16572141/2668136

Community
  • 1
  • 1
Blo
  • 11,903
  • 5
  • 45
  • 99
  • It throw me this error: error: No resource identifier found for attribute 'class' in package 'android' – German Katz Nov 19 '13 at 18:04
  • You need to set your build target (e.g. Properties > Android in Eclipse) to API Google Services on your Build sdk version. See my update answer. – Blo Nov 19 '13 at 18:14