[mono-android] maps - I'm doing something wrong

Jonathan Pryor jonp at xamarin.com
Thu Nov 10 15:34:21 EST 2011


On Nov 9, 2011, at 11:38 PM, Wally McClure wrote:
> The map_view is null and Null Reference Exception occurs at this line:
> map_view.Overlays.Add(location_overlay);

Some investigation later, this appears to happen primarily on the emulator, and not on hardware.

Specifically, when I ran my app on a v4.0 emulator, logcat has this wonderful snippet:

	W/dalvikvm(  695): JNI WARNING: can't call Ljava/util/ArrayList;.add on instance of Ljava/util/Collections$SynchronizedRandomAccessList;
	W/dalvikvm(  695):              in Lscratchmaps/Activity1;.n_onCreate:(Landroid/os/Bundle;)V (CallBooleanMethodA)
	I/dalvikvm(  695): "main" prio=5 tid=1 RUNNABLE
	...
	E/mono    (  695): Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object
	E/mono    (  695):   at (wrapper delegate-invoke) <Module>:invoke_bool__this___intptr_intptr_intptr_JValue[] (intptr,intptr,intptr,Android.Runtime.JValue[])
	E/mono    (  695):   at Android.Runtime.JNIEnv.CallBooleanMethod (IntPtr jobject, IntPtr jmethod, Android.Runtime.JValue[] parms) [0x00000] in <filename unknown>:0 
	E/mono    (  695):   at Android.Runtime.JavaList.Add (IJavaObject obj) [0x00000] in <filename unknown>:0 
	...

Much as I'm annoyed at Google for breaking Mono for Android 1.2.0 on ICS, I do love their improved JNI checking...

This is a bug. I'll look into getting this fixed in our next release.

Thanks,
- Jon



More information about the Monodroid mailing list