Closed Sonnenspeer closed 6 years ago
This is most likely due to a version mismatch somewhere, try adding Itinero (1.4.0-pre59) in the project directly.
Perhaps there is something wrong with the nugets.
Also, when working on mobile it's best to create your routing data offline and use that in the app. Usually that means:
There is more info in the docs: http://docs.itinero.tech/docs/itinero/basic-concepts/routerdb.html
Adding the assemblies (Itinero, Itinero.IO.Osm, Reminiscence) directly to the project fixed it. This is strange, how can there be a missmatch when this is the very same assembly? I would love if this could be fixed anyhow for the nugets because referencing assemblies instead of nugets is not handsome.
Thanks for the advice above. Will use that for my mobile app.
Closing this, feel free to reopen if this is not closed for you.
I've tried today to load osm data in Xamarin Forms to create a new route but it's breaking as soon as it's trying to load the osm data.
My Code:
using (var stream = new FileInfo(Path.Combine(localPath, "luxembourg-latest.osm.pbf")).OpenRead()) { routerDb.LoadOsmData(stream, Vehicle.Pedestrian); // create the network. }
Exception:
Unhandled Exception: System.MissingMethodException: bool Itinero.Attributes.IAttributeCollection.TryGetValue(string,string&)
Exception with Stacktrace: ` Unhandled Exception:
System.MissingMethodException: bool Itinero.Attributes.IAttributeCollection.TryGetValue(string,string&)
06-05 17:20:33.360 D/Mono ( 6514): DllImport attempting to load: '/system/lib/liblog.so'. 06-05 17:20:33.360 D/Mono ( 6514): DllImport loaded library '/system/lib/liblog.so'. 06-05 17:20:33.360 D/Mono ( 6514): DllImport searching in: '/system/lib/liblog.so' ('/system/lib/liblog.so'). 06-05 17:20:33.360 D/Mono ( 6514): Searching for 'android_log_print'. 06-05 17:20:33.360 D/Mono ( 6514): Probing 'android_log_print'. 06-05 17:20:33.360 D/Mono ( 6514): Found as 'android_log_print'. 06-05 17:20:33.370 I/MonoDroid( 6514): UNHANDLED EXCEPTION: 06-05 17:20:33.465 I/MonoDroid( 6514): System.MissingMethodException: bool Itinero.Attributes.IAttributeCollection.TryGetValue(string,string&) 06-05 17:20:33.465 I/MonoDroid( 6514): at Itinero.IO.Osm.Streams.RouterDbStreamTarget.b 23_0 (OsmSharp.OsmGeo osmGeo, System.Object param) [0x0001e] in <8ef2211a617d4541bf5c66536aa2c840>:0
06-05 17:20:33.465 I/MonoDroid( 6514): at OsmSharp.Streams.Filters.OsmStreamFilterDelegate.MoveNext (System.Boolean ignoreNodes, System.Boolean ignoreWays, System.Boolean ignoreRelations) [0x0001b] in <06adcc0b134f46388331c8e6baa48ee0>:0
06-05 17:20:33.465 I/MonoDroid( 6514): at OsmSharp.Streams.OsmStreamTarget.DoPull (System.Boolean ignoreNodes, System.Boolean ignoreWays, System.Boolean ignoreRelations) [0x00051] in <06adcc0b134f46388331c8e6baa48ee0>:0
06-05 17:20:33.465 I/MonoDroid( 6514): at Itinero.IO.Osm.Streams.RouterDbStreamTarget.OnBeforePull () [0x00000] in <8ef2211a617d4541bf5c66536aa2c840>:0
06-05 17:20:33.465 I/MonoDroid( 6514): at OsmSharp.Streams.OsmStreamTarget.Pull () [0x00006] in <06adcc0b134f46388331c8e6baa48ee0>:0
06-05 17:20:33.465 I/MonoDroid( 6514): at Itinero.IO.Osm.RouterDbExtensions.LoadOsmData (Itinero.RouterDb db, OsmSharp.Streams.OsmStreamSource[] sources, Itinero.IO.Osm.LoadSettings settings, Itinero.Profiles.Vehicle[] vehicles) [0x000c3] in <8ef2211a617d4541bf5c66536aa2c840>:0
06-05 17:20:33.465 I/MonoDroid( 6514): at Itinero.IO.Osm.RouterDbExtensions.LoadOsmData (Itinero.RouterDb db, OsmSharp.Streams.OsmStreamSource[] sources, System.Boolean allCore, System.Boolean processRestrictions, System.Collections.Generic.IEnumerable`1[T] processors, Itinero.Profiles.Vehicle[] vehicles) [0x0001d] in <8ef2211a617d4541bf5c66536aa2c840>:0
06-05 17:20:33.465 I/MonoDroid( 6514): at Itinero.IO.Osm.RouterDbExtensions.LoadOsmData (Itinero.RouterDb db, OsmSharp.Streams.OsmStreamSource[] sources, System.Boolean allCore, System.Boolean processRestrictions, Itinero.Profiles.Vehicle[] vehicles) [0x00000] in <8ef2211a617d4541bf5c66536aa2c840>:0
06-05 17:20:33.465 I/MonoDroid( 6514): at Itinero.IO.Osm.RouterDbExtensions.LoadOsmData (Itinero.RouterDb db, OsmSharp.Streams.OsmStreamSource source, System.Boolean allCore, System.Boolean processRestrictions, Itinero.Profiles.Vehicle[] vehicles) [0x00000] in <8ef2211a617d4541bf5c66536aa2c840>:0
06-05 17:20:33.465 I/MonoDroid( 6514): at Itinero.IO.Osm.RouterDbExtensions.LoadOsmData (Itinero.RouterDb db, System.IO.Stream data, System.Boolean allCore, Itinero.Profiles.Vehicle[] vehicles) [0x00027] in <8ef2211a617d4541bf5c66536aa2c840>:0
06-05 17:20:33.465 I/MonoDroid( 6514): at Itinero.IO.Osm.RouterDbExtensions.LoadOsmData (Itinero.RouterDb db, System.IO.Stream data, Itinero.Profiles.Vehicle[] vehicles) [0x00000] in <8ef2211a617d4541bf5c66536aa2c840>:0
06-05 17:20:33.465 I/MonoDroid( 6514): at MapNavigation2017.MapView.Route (Plugin.Geolocator.Abstractions.Position startPosition, Plugin.Geolocator.Abstractions.Position endPosition) [0x00034] in C:\Users\praktikant\source\repos\MapNavigation2017\MapNavigation2017\MapNavigation2017\MapView.cs:439
06-05 17:20:33.465 I/MonoDroid( 6514): at MapNavigation2017.MapPage..ctor () [0x00071] in C:\Users\praktikant\source\repos\MapNavigation2017\MapNavigation2017\MapNavigation2017\MapPage.xaml.cs:36
06-05 17:20:33.465 I/MonoDroid( 6514): at MapNavigation2017.App..ctor () [0x0000f] in C:\Users\praktikant\source\repos\MapNavigation2017\MapNavigation2017\MapNavigation2017\App.xaml.cs:14
06-05 17:20:33.465 I/MonoDroid( 6514): at MapNavigation2017.Droid.MainActivity.OnCreate (Android.OS.Bundle bundle) [0x0003d] in C:\Users\praktikant\source\repos\MapNavigation2017\MapNavigation2017\MapNavigation2017.Android\MainActivity.cs:24
06-05 17:20:33.465 I/MonoDroid( 6514): at Android.App.Activity.n_OnCreate_Landroid_osBundle (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_savedInstanceState) [0x0000f] in <263adecfa58f4c449f1ff56156d886fd>:0
06-05 17:20:33.465 I/MonoDroid( 6514): at (wrapper dynamic-method) System.Object.a867fc51-9a31-4eee-b170-3b9b05e8c4e0(intptr,intptr,intptr)
06-05 17:20:33.490 I/dalvikvm( 6514): Could not find method java.lang.Error., referenced from method android.runtime.JavaProxyThrowable.
06-05 17:20:33.490 W/dalvikvm( 6514): VFY: unable to resolve direct method 22848: Ljava/lang/Error;. (Ljava/lang/String;Ljava/lang/Throwable;ZZ)V
06-05 17:20:33.490 D/dalvikvm( 6514): VFY: replacing opcode 0x70 at 0x0000
06-05 17:20:33.495 D/Mono ( 6514): DllImport searching in: '__Internal' ('(null)').
06-05 17:20:33.495 D/Mono ( 6514): Searching for 'java_interop_jnienv_throw'.
06-05 17:20:33.495 D/Mono ( 6514): Probing 'java_interop_jnienv_throw'.
06-05 17:20:33.495 D/Mono ( 6514): Found as 'java_interop_jnienv_throw'.
An unhandled exception occured.
06-05 17:20:36.350 E/mono ( 6514): In mgmain JNI_OnLoad
06-05 17:20:36.350 E/mono ( 6514): Unhandled Exception: 06-05 17:20:36.350 E/mono ( 6514): System.MissingMethodException: bool Itinero.Attributes.IAttributeCollection.TryGetValue(string,string&) 06-05 17:20:36.350 E/mono ( 6514): at (wrapper dynamic-method) System.Object.a867fc51-9a31-4eee-b170-3b9b05e8c4e0(intptr,intptr,intptr) 06-05 17:20:36.355 E/mono-rt ( 6514): [ERROR] FATAL UNHANDLED EXCEPTION: System.MissingMethodException: bool Itinero.Attributes.IAttributeCollection.TryGetValue(string,string&) 06-05 17:20:36.355 E/mono-rt ( 6514): at (wrapper dynamic-method) System.Object.a867fc51-9a31-4eee-b170-3b9b05e8c4e0(intptr,intptr,intptr) `
Don't know what I'm doing wrong. The osm.pbf file is from the Itinero file Server for testing purpose. I've downloaded it and pasted as resource. Then copied the resource at runtime to local app path.
Using the latest version of Itinero and Itinero.IO.Osm (1.4.0-pre59)