android - SupportMapFragment doesn't start on SDK 10 -
i created android application uses supportmapfragment. have able use on sdk 10 well. although outdated version, i'm obliged use it...
when starting activity supportmapfragment, app crashes error message:
04-25 14:47:15.160 537-537/? e/androidruntime﹕ fatal exception: main java.lang.runtimeexception: unable start activity componentinfo{lokeren.viae.com.lokeren/com.viae.notification.activity.mapactivity}: android.view.inflateexception: binary xml file line #21: error inflating class fragment @ android.app.activitythread.performlaunchactivity(activitythread.java:1647) @ android.app.activitythread.handlelaunchactivity(activitythread.java:1663) @ android.app.activitythread.access$1500(activitythread.java:117) @ android.app.activitythread$h.handlemessage(activitythread.java:931) @ android.os.handler.dispatchmessage(handler.java:99) @ android.os.looper.loop(looper.java:123) @ android.app.activitythread.main(activitythread.java:3683) @ java.lang.reflect.method.invokenative(native method) @ java.lang.reflect.method.invoke(method.java:507) @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:839) @ com.android.internal.os.zygoteinit.main(zygoteinit.java:597) @ dalvik.system.nativestart.main(native method) caused by: android.view.inflateexception: binary xml file line #21: error inflating class fragment @ android.view.layoutinflater.createviewfromtag(layoutinflater.java:581) @ android.view.layoutinflater.rinflate(layoutinflater.java:623) @ android.view.layoutinflater.rinflate(layoutinflater.java:626) @ android.view.layoutinflater.rinflate(layoutinflater.java:626) @ android.view.layoutinflater.inflate(layoutinflater.java:408) @ android.view.layoutinflater.inflate(layoutinflater.java:320) @ android.view.layoutinflater.inflate(layoutinflater.java:276) @ com.android.internal.policy.impl.phonewindow.setcontentview(phonewindow.java:207) @ android.app.activity.setcontentview(activity.java:1657) @ com.viae.notification.activity.mapactivity.oncreate(mapactivity.java:100) @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1047) @ android.app.activitythread.performlaunchactivity(activitythread.java:1611) caused by: java.lang.classnotfoundexception: android.view.fragment in loader dalvik.system.pathclassloader[/data/app/lokeren.viae.com.lokeren-1.apk] @ dalvik.system.pathclassloader.findclass(pathclassloader.java:240) @ java.lang.classloader.loadclass(classloader.java:551) @ java.lang.classloader.loadclass(classloader.java:511) @ android.view.layoutinflater.createview(layoutinflater.java:471) @ android.view.layoutinflater.oncreateview(layoutinflater.java:549) @ com.android.internal.policy.impl.phonelayoutinflater.oncreateview(phonelayoutinflater.java:66) @ android.view.layoutinflater.createviewfromtag(layoutinflater.java:568)
this 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 activity configuration:
<android.support.v4.widget.drawerlayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent"> <!-- 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> <!-- 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://schemas.android.com/apk/res/android" 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 tell me i'm doing wrong? 'cus read in documentation, should available on sdk 10 too...
i had double fragment block inside activity: layout file.
when remove it, null google map:
this results in null:
map = ((supportmapfragment) getsupportfragmentmanager().findfragmentbyid(r.id.google_map)).getmap();
while layout file now
<android.support.v4.widget.drawerlayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent"> <!-- 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" /> </linearlayout> </framelayout> <!-- 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://schemas.android.com/apk/res/android" 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>
Comments
Post a Comment