android - google maps ane: RuntimeException: Attempting to create multiple DataRequestDispatchers -
i'm creating native extension shows native google map flex-based air application. can watch lee brimelow's demo idea: https://plus.google.com/110495278155587072613/posts/degsyvx8423
i got working demo of native extension, show activity buttons, got stuck when tried show map. here exception i'm getting on setcontentview(layoutid):
05-08 11:48:40.624: i/system.out(27917): webviewactivity.oncreate failed error: 05-08 11:48:40.634: i/system.out(27917): "android.view.inflateexception: binary xml file line #9: error inflating class fragment" 05-08 11:48:40.644: w/dalvikvm(27917): threadid=1: thread exiting uncaught exception (group=0x40fd8468) 05-08 11:48:40.654: e/androidruntime(27917): fatal exception: main 05-08 11:48:40.654: e/androidruntime(27917): java.lang.runtimeexception: unable start activity componentinfo{air.googlemapsapp.debug/com.trasys.googlemaps.webviewactivity}: java.lang.runtimeexception: attempting create multiple datarequestdispatchers 05-08 11:48:40.654: e/androidruntime(27917): @ android.app.activitythread.performlaunchactivity(activitythread.java:2351) 05-08 11:48:40.654: e/androidruntime(27917): @ android.app.activitythread.handlelaunchactivity(activitythread.java:2387) 05-08 11:48:40.654: e/androidruntime(27917): @ android.app.activitythread.access$600(activitythread.java:151) 05-08 11:48:40.654: e/androidruntime(27917): @ android.app.activitythread$h.handlemessage(activitythread.java:1331) 05-08 11:48:40.654: e/androidruntime(27917): @ android.os.handler.dispatchmessage(handler.java:99) 05-08 11:48:40.654: e/androidruntime(27917): @ android.os.looper.loop(looper.java:155) 05-08 11:48:40.654: e/androidruntime(27917): @ android.app.activitythread.main(activitythread.java:5454) 05-08 11:48:40.654: e/androidruntime(27917): @ java.lang.reflect.method.invokenative(native method) 05-08 11:48:40.654: e/androidruntime(27917): @ java.lang.reflect.method.invoke(method.java:511) 05-08 11:48:40.654: e/androidruntime(27917): @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:1029) 05-08 11:48:40.654: e/androidruntime(27917): @ com.android.internal.os.zygoteinit.main(zygoteinit.java:796) 05-08 11:48:40.654: e/androidruntime(27917): @ dalvik.system.nativestart.main(native method) 05-08 11:48:40.654: e/androidruntime(27917): caused by: java.lang.runtimeexception: attempting create multiple datarequestdispatchers 05-08 11:48:40.654: e/androidruntime(27917): @ maps.ak.n.b(unknown source) 05-08 11:48:40.654: e/androidruntime(27917): @ maps.ak.n.a(unknown source) 05-08 11:48:40.654: e/androidruntime(27917): @ maps.ak.h.a(unknown source) 05-08 11:48:40.654: e/androidruntime(27917): @ maps.af.w.a(unknown source) 05-08 11:48:40.654: e/androidruntime(27917): @ maps.z.ab.a(unknown source) 05-08 11:48:40.654: e/androidruntime(27917): @ maps.z.ab.a(unknown source) 05-08 11:48:40.654: e/androidruntime(27917): @ maps.z.ag.a(unknown source) 05-08 11:48:40.654: e/androidruntime(27917): @ maps.z.ag.a(unknown source) 05-08 11:48:40.654: e/androidruntime(27917): @ maps.z.bw.a(unknown source) 05-08 11:48:40.654: e/androidruntime(27917): @ maps.z.r.oncreateview(unknown source) 05-08 11:48:40.654: e/androidruntime(27917): @ com.google.android.gms.maps.internal.imapfragmentdelegate$stub.ontransact(imapfragmentdelegate.java:107) 05-08 11:48:40.654: e/androidruntime(27917): @ android.os.binder.transact(binder.java:326) 05-08 11:48:40.654: e/androidruntime(27917): @ com.google.android.gms.maps.internal.imapfragmentdelegate$a$a.oncreateview(unknown source) 05-08 11:48:40.654: e/androidruntime(27917): @ com.google.android.gms.maps.mapfragment$b.oncreateview(unknown source) 05-08 11:48:40.654: e/androidruntime(27917): @ com.google.android.gms.internal.e$4.a(unknown source) 05-08 11:48:40.654: e/androidruntime(27917): @ com.google.android.gms.internal.e.a(unknown source) 05-08 11:48:40.654: e/androidruntime(27917): @ com.google.android.gms.internal.e.oncreateview(unknown source) 05-08 11:48:40.654: e/androidruntime(27917): @ com.google.android.gms.maps.mapfragment.oncreateview(unknown source) 05-08 11:48:40.654: e/androidruntime(27917): @ android.app.fragmentmanagerimpl.movetostate(fragmentmanager.java:809) 05-08 11:48:40.654: e/androidruntime(27917): @ android.app.fragmentmanagerimpl.movetostate(fragmentmanager.java:1037) 05-08 11:48:40.654: e/androidruntime(27917): @ android.app.fragmentmanagerimpl.movetostate(fragmentmanager.java:1019) 05-08 11:48:40.654: e/androidruntime(27917): @ android.app.fragmentmanagerimpl.dispatchactivitycreated(fragmentmanager.java:1804) 05-08 11:48:40.654: e/androidruntime(27917): @ android.app.activity.performcreate(activity.java:5069) 05-08 11:48:40.654: e/androidruntime(27917): @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1101) 05-08 11:48:40.654: e/androidruntime(27917): @ android.app.activitythread.performlaunchactivity(activitythread.java:2307) 05-08 11:48:40.654: e/androidruntime(27917): ... 11 more
i'm pretty convinced communication between air , android ok, i'm posting native code. (when remove map, native extension works no issues)
here layout xml file
<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center_horizontal" android:orientation="vertical" > <fragment android:id="@+id/map" android:name="com.google.android.gms.maps.mapfragment" android:layout_width="match_parent" android:layout_height="300dp" /> </linearlayout>
here frefunction
public class googlemapsfunction implements frefunction { @override public freobject call(frecontext ctx, freobject[] passedargs) { int layoutid, googlemapid; intent = new intent(ctx.getactivity(), webviewactivity.class); layoutid = ctx.getresourceid("layout.activity_google_maps"); googlemapid = ctx.getresourceid("id.map"); i.putextra("layoutid", layoutid); i.putextra("googlemapid", googlemapid); ctx.getactivity().startactivity(i); return null; } }
here activity
public class webviewactivity extends activity { private googlemap map; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); try { int layoutid = getintent().getintextra("layoutid", -1); setcontentview(layoutid); int googlemapid = getintent().getintextra("googlemapid", -1); map = ((mapfragment) getfragmentmanager().findfragmentbyid(googlemapid)) .getmap(); } catch(exception e){ system.out.printf("webviewactivity.oncreate failed error:\n\"%s\"\n", e.tostring()); toast.maketext(this, "webviewactivity.oncreate failed: " + e.tostring(), toast.length_short).show(); } } }
here androidmanifest
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.trasys.googlemaps" android:versioncode="1" android:versionname="1.0" > <uses-sdk android:minsdkversion="11" android:targetsdkversion="17" /> <permission android:name="com.example.helloworld.permission.c2d_message" android:protectionlevel="signature" /> <uses-permission android:name="com.example.helloworld.permission.c2d_message" /> <permission android:name="com.example.helloworld.permission.maps_receive" android:protectionlevel="signature"/> <uses-permission android:name="com.example.helloworld.permission.maps_receive"/> <!-- app receives gcm messages. --> <uses-permission android:name="com.google.android.c2dm.permission.receive" /> <!-- gcm connects google services. --> <uses-permission android:name="android.permission.internet" /> <!-- gcm requires google account. --> <uses-permission android:name="android.permission.get_accounts" /> <!-- keeps processor sleeping when message received. --> <uses-permission android:name="android.permission.wake_lock" /> <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"/> <!-- following 2 permissions not required use google maps android api v2, recommended. --> <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:icon="@drawable/ic_launcher" android:label="@string/app_name"> <meta-data android:name="com.google.android.maps.v2.api_key" android:value="myapikey"/> </application> </manifest>
i see com.google.android.gms. entries in stacktrace, assume google libraries loaded correctly.
i created separate pure native android application testing purpose. in app managed create activity displays map, activity uses same layout xml, same google libraries , same api key.
any idea's?
you need include third party classes on jar file why fragment class not found "error inflating class fragment" .
after exporting java files open jar file zip tool 7-zip, browse com folder , copy packages third party jar file (opening same way). after need recreate ane file.
Comments
Post a Comment