Map renderer exception.
See original GitHub issueHi TK, Thanks for your great job.
I got following exception when setting up a customMap in my project. ‘’’ 12-10 16:58:52.143 I/MonoDroid(27188): UNHANDLED EXCEPTION: 12-10 16:58:52.163 I/MonoDroid(27188): System.NullReferenceException: Object reference not set to an instance of an object 12-10 16:58:52.164 I/MonoDroid(27188): at TK.CustomMap.Droid.TKCustomMapRenderer.MoveToCenter () [0x0000c] in <filename unknown>:0 12-10 16:58:52.164 I/MonoDroid(27188): at TK.CustomMap.Droid.TKCustomMapRenderer.OnLayout (Boolean changed, Int32 l, Int32 t, Int32 r, Int32 b) [0x00015] in <filename unknown>:0 12-10 16:58:52.165 I/MonoDroid(27188): at Xamarin.Forms.Platform.Android.FormsViewGroup.n_OnLayout_ZIIII (IntPtr jnienv, IntPtr native__this, Boolean p0, Int32 p1, Int32 p2, Int32 p3, Int32 p4) [0x00008] in <filename unknown>:0 12-10 16:58:52.165 I/MonoDroid(27188): at (wrapper dynamic-method) System.Object:b029f907-c661-475e-b1ec-ddf53eca71ac (intptr,intptr,bool,int,int,int,int) 12-10 16:58:52.177 W/art (27188): JNI RegisterNativeMethods: attempt to register 0 native methods for md52ce486a14f4bcd95899665e9d932190b.JavaProxyThrowable An unhandled exception occured.
Thread finished: <Thread Pool> #3
The thread ‘<Thread Pool>’ (0x3) has exited with code 0 (0x0).
12-10 17:00:08.875 I/MonoDroid(27188): UNHANDLED EXCEPTION:
Thread started: <Thread Pool> #9
12-10 17:00:08.928 I/MonoDroid(27188): System.NullReferenceException: Object reference not set to an instance of an object
12-10 17:00:08.928 I/MonoDroid(27188): at (wrapper dynamic-method) System.Object:b029f907-c661-475e-b1ec-ddf53eca71ac (intptr,intptr,bool,int,int,int,int)
12-10 17:00:08.929 I/MonoDroid(27188): at (wrapper native-to-managed) System.Object:b029f907-c661-475e-b1ec-ddf53eca71ac (intptr,intptr,int,int,int,int,int)
12-10 17:00:08.929 I/MonoDroid(27188): at (wrapper managed-to-native) System.Object:wrapper_native_0xb47b0db1 (intptr,intptr,intptr,intptr,Android.Runtime.JValue_)
12-10 17:00:08.929 I/MonoDroid(27188): at (wrapper delegate-invoke) <Module>:invoke_void_intptr_intptr_intptr_intptr_JValue_ (intptr,intptr,intptr,intptr,Android.Runtime.JValue_)
12-10 17:00:08.930 I/MonoDroid(27188): at Android.Runtime.JNIEnv.CallNonvirtualVoidMethod (IntPtr jobject, IntPtr jclass, IntPtr jmethod, Android.Runtime.JValue_ parms) [0x00060] in /Users/builder/data/lanes/2512/d3008455/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:1025
12-10 17:00:08.930 I/MonoDroid(27188): at Xamarin.Forms.Platform.Android.FormsViewGroup.MeasureAndLayout (Int32 p0, Int32 p1, Int32 p2, Int32 p3, Int32 p4, Int32 p5) [0x000f8] in <filename unknown>:0
12-10 17:00:08.930 I/MonoDroid(27188): at Xamarin.Forms.Platform.Android.VisualElementTracker.UpdateLayout () [0x000bc] in <filename unknown>:0
12-10 17:00:08.930 I/MonoDroid(27188): at Xamarin.Forms.Platform.Android.VisualElementRenderer1[TElement].UpdateLayout () [0x00008] in <filename unknown>:0 12-10 17:00:08.931 I/MonoDroid(27188): at Xamarin.Forms.Platform.Android.VisualElementRenderer
1[TElement].OnLayout (Boolean changed, Int32 l, Int32 t, Int32 r, Int32 b) [0x0003d] in <filename unknown>:0
12-10 17:00:08.931 I/MonoDroid(27188): at Xamarin.Forms.Platform.Android.FormsViewGroup.n_OnLayout_ZIIII (IntPtr jnienv, IntPtr native__this, Boolean p0, Int32 p1, Int32 p2, Int32 p3, Int32 p4) [0x00008] in <filename unknown>:0
12-10 17:00:08.932 I/MonoDroid(27188): at (wrapper dynamic-method) System.Object:b029f907-c661-475e-b1ec-ddf53eca71ac (intptr,intptr,bool,int,int,int,int)
12-10 17:00:08.932 E/art (27188): JNI NewString called with pending exception ‘md52ce486a14f4bcd95899665e9d932190b.JavaProxyThrowable’ thrown in void md55b85883da287a270e8ac6f2218732aaf.TKCustomMapRenderer.n_onLayout(boolean, int, int, int, int):-2
An unhandled exception occured.
‘’’
XAML code:
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:customMap="clr-namespace:TK.CustomMap;assembly=TK.CustomMap"
xmlns:controls="clr-namespace:Test.Controls;assembly=Test"
x:Class="Test.Views.MapPage">
<StackLayout>
<customMap:TKCustomMap/>
</StackLayout>
</ContentPage>
I tested this code on your sample project and it works well.
Am i missing something?
Issue Analytics
- State:
- Created 8 years ago
- Comments:9 (7 by maintainers)
Top GitHub Comments
Hi there, thank you very much for your reply! I did as you said.
But now I am getting this error:
System.MissingMethodException: Default constructor not found for type TK.CustomMap.TKCustomMap
my XAML looks like this:
<?xml version="1.0" encoding="utf-8" ?><ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:local="clr-namespace:test;assembly=test" xmlns:customMap="clr-namespace:TK.CustomMap;assembly=TK.CustomMap" x:Class="test.pageMap"> <ContentPage.Content> <Grid RowSpacing="0" ColumnSpacing="0" BackgroundColor="{DynamicResource bgColor}"> <Grid.ColumnDefinitions> <ColumnDefinition Width="1*"/> <ColumnDefinition Width="1*"/> <ColumnDefinition Width="1*"/> <ColumnDefinition Width="1*"/> </Grid.ColumnDefinitions>
</ContentPage.Content> </ContentPage>
and my Code:
maybe I am missing something?
Hi,
use
CustomPins
. Please check the samples.