-1

My app is supposed to open a map. I have included play services, implemented fragments and done everything that I could! However I am getting a "cannot inflate" kind of error during run time.

I am putting my manifest file, layout file and logcat errors.

Manifest

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

<uses-sdk
    android:minSdkVersion="11"
    android:targetSdkVersion="21" />

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

<permission
android:name="xyz.xyz.permission.MAPS_RECEIVE"
android:protectionLevel="signature"
/>
<uses-permission android:name="xyz.xyz.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" />
<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <uses-library android:name="com.google.android.maps" />
    <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>
    <activity android:name=".HelloGoogleMaps" android:label="@string/app_name"
 android:theme="@android:style/Theme.NoTitleBar"/>
     <uses-library android:name="com.google.android.maps"/>
</application>

Layout

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"

tools:context="xyz.xyz.Home" >


        <fragment
            android:id="@+id/mapView"
            android:name="com.google.android.gms.maps.MapFragment"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:layout_alignParentLeft="true"
            android:layout_below="@+id/acceleration"
            android:layout_marginTop="20dp"
            android:apiKey="GoogleAPIKEY//I Added a Key, I just do not feel comfortable to display it"
            android:clickable="true"
            android:enabled="true" />

</RelativeLayout>

Logcat

01-05 04:33:18.003: E/AndroidRuntime(9303): FATAL EXCEPTION: main
01-05 04:33:18.003: E/AndroidRuntime(9303): java.lang.RuntimeException: Unable to start activity ComponentInfo{xyz.xyz/xyz.xyz.Home}: android.view.InflateException: Binary XML file line #20: Error inflating class fragment
01-05 04:33:18.003: E/AndroidRuntime(9303): Caused by: java.lang.IllegalStateException: A required meta-data tag in your app's AndroidManifest.xml does not exist.  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" />
01-05 04:33:18.003: E/AndroidRuntime(9303):     at com.google.android.gms.common.GooglePlayServicesUtil.A(Unknown Source)
01-05 04:33:18.003: E/AndroidRuntime(9303):     at com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable(Unknown Source)

There were more but these looked important. Also what it says to add as meta-data has been added and it is still generating an exception.

halfer
  • 19,824
  • 17
  • 99
  • 186

1 Answers1

0

Do you have Google Play Service library in your Android SDK? If not, go and check http://developer.android.com/google/play-services/setup.html. If you want offline download for Google Play Service, go http://venomvendor.blogspot.com/2012/03/android-sdk-extras-by-google-inc.html.

  • Done that too! The error shows something about a fragment not being inflated. I will appreciate answers pertaining to that only. I still haven't figured a way out of this. – user2857958 Oct 07 '14 at 19:24