[mono-android] monodroid-samples/ApiDemo exception at start-up

Jonathan Pryor jpryor at novell.com
Tue Mar 15 17:08:28 EDT 2011


On Mar 15, 2011, at 3:39 PM, Len Charest wrote:
> I'm trying to run the ApiDemo sample app (found at https://github.com/mono/monodroid-samples) in an emulator. The app crashes at start-up with the following error:
> 
> E/mono    ( 1591): Unhandled Exception: System.TypeInitializationException: An exception was thrown by the type initializer for Android.Util.Log ---> System.NullReferenceException: Object reference not set to an instance of an object
> E/mono    ( 1591):   at Android.Runtime.JNIEnv.FindClass (System.String classname) [0x00000] in <filename unknown>:0 
> E/mono    ( 1591):   at Android.Util.Log..cctor () [0x00000] in <filename unknown>:0 
> E/mono    ( 1591):   --- End of inner exception stack trace ---

That is very, very, odd.

That said, I get a _different_ error when I try a Release build of ApiDemo with Preview 14:

	I/MonoDroid(  510): UNHANDLED EXCEPTION: System.TypeInitializationException: An exception was thrown by the type initializer for Android.Widget.ItemClickImplementor ---> System.ArgumentException: Couldn't bind to method 'GetOnItemClickHandler'.

My bug appears to be a linker bug; disabling the linker (`/p:AndroidLinkMode=None`) allows it to work for me.

However, my issues seem unrelated to yours, so what output do you see before those messages? Specifically, can you provide everything from the message similar to:

	I/ActivityManager(12944): Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=Mono.Samples.HelloTests/mono.samples.HelloApp } from pid 1637

until the crash?

 - Jon



More information about the Monodroid mailing list