samedi 25 avril 2015

SupportMapFragment doesn't start on SDK 10


I created an Android application which uses the SupportMapFragment. Now I have to be able to use it on SDK 10 as well. Although this is really an outdated version, I'm obliged to use it...

When starting the activity with the SupportMapFragment, the app crashes with this error message:

java.lang.RuntimeException: Unable to start activity ComponentInfo{lokeren.viae.com.lokeren/com.viae.notification.activity.MapActivity}: android.view.InflateException: Binary XML file line #21: Error inflating class fragment

This is my AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>

<permission
    android:name="com.viae.notification.maps.permission.MAPS_RECEIVE"
    android:protectionLevel="signature" />

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


<uses-permission android:name="com.viae.notification.maps.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="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.CAMERA" />
<!-- TEST -->
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />

<uses-feature
    android:name="android.hardware.camera"
    android:required="false" />
<!-- android:theme="@style/AppTheme"
        android:theme="@android:style/Theme.AppCompat.Light"
        android:theme="@style/Theme.AppCompat.-->
<application
    android:allowBackup="true"
    android:exported="true"
    android:icon="@drawable/logo"
    android:label="@string/app_name"
    android:theme="@style/AppTheme">
    <activity
        android:name="com.viae.notification.activity.MapActivity"
        android:label="Lokeren">
        <meta-data
            android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version" />
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity
        android:name="com.viae.notification.activity.NotificationActivity"
        android:label="Melding">
        <meta-data
            android:name="android.support.PARENT_ACTIVITY"
            android:value="com.viae.notification.activity.MapActivity" />
    </activity>

    <service
        android:name="com.viae.common.service.impl.LocationService"
        android:label="@string/viae_location_service_name"></service>

    <service
        android:name="com.viae.notification.database.service.impl.NotificationService"
        android:label="@string/viae_notification_service_name"></service>

    <provider
        android:name="com.viae.notification.database.provider.NotificationProvider"
        android:authorities="com.viae.stad.lokeren.Notification"
        android:exported="false" />

    <provider
        android:name="com.viae.notification.database.provider.NotificationImageProvider"
        android:authorities="com.viae.stad.lokeren.NotificationImage"
        android:exported="false" />

    <provider
        android:name="com.viae.notification.database.provider.UrgencyProvider"
        android:authorities="com.viae.stad.lokeren.Urgency"
        android:exported="false" />

    <provider
        android:name="com.viae.notification.database.provider.CategoryProvider"
        android:authorities="com.viae.stad.lokeren.Category"
        android:exported="false" />

    <provider
        android:name="com.viae.notification.database.provider.CountryProvider"
        android:authorities="com.viae.stad.lokeren.Country"
        android:exported="false" />

    <provider
        android:name="com.viae.notification.database.provider.CityProvider"
        android:authorities="com.viae.stad.lokeren.City"
        android:exported="false" />

    <provider
        android:name="com.viae.notification.database.provider.AddressProvider"
        android:authorities="com.viae.stad.lokeren.Address"
        android:exported="false" />

    <meta-data
        android:name="com.google.android.maps.v2.API_KEY"
        android:value="xxxxxx" />
</application>

And this is my activity configuration:

<android.support.v4.widget.DrawerLayout xmlns:android="http://ift.tt/nIICcg"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- The main content view -->
<FrameLayout
    android:id="@+id/content_frame"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <fragment
            android:id="@+id/google_map"
            class="com.google.android.gms.maps.SupportMapFragment"
            android:layout_width="fill_parent"
            android:layout_height="match_parent"
            android:layout_weight="1" />

        <fragment
            android:id="@+id/menu"
            class="com.viae.notification.activity.MenuFragment"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />
    </LinearLayout>
</FrameLayout>
<!-- The navigation drawer -->
<LinearLayout
    android:layout_width="240dp"
    android:layout_height="match_parent"
    android:layout_gravity="start"
    android:gravity="bottom|center"
    android:orientation="vertical">

    <android.support.v4.widget.SwipeRefreshLayout xmlns:android="http://ift.tt/nIICcg"
        android:id="@+id/swipe_container"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <ListView
            android:id="@+id/left_drawer"
            android:layout_width="240dp"
            android:layout_height="match_parent"
            android:layout_gravity="start"
            android:background="#ffffff"
            android:choiceMode="singleChoice"
            android:divider="@android:color/darker_gray"
            android:dividerHeight="0dp" />
    </android.support.v4.widget.SwipeRefreshLayout>
</LinearLayout>

Can someone tell me what I'm doing wrong? 'cus as I read in the documentation, this should be available on SDK 10 too...


Aucun commentaire:

Enregistrer un commentaire