Samy S.Rathore
Samy S.Rathore

Reputation: 1823

Xamarin Android | UI shows up blank in device

I'm developing android app for learning purpose. I've installed Xamarin 4.2.1.60 on my laptop. I created a simple Layout and tried to run it on my One Plus 3 (Android M 6.0.1) and Moto G (Android L 5.1) 1st Gen but the layout shows up empty in both of them. It also gives me a below Exception on running:

Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.

On pressing break, a window open in Visual Studio with Header saying Source Not Available (Please see attached screenshots)

Please suggest how can I resolve this.

Designer Screen:

Designer Screen

Device Screen:

Device Screen

Exception Window: Exception Window

Upvotes: 0

Views: 847

Answers (1)

Jon Douglas
Jon Douglas

Reputation: 13176

Make sure to set a default SetContentView() in your MainActivity.OnCreate() with a valid Android layout.

Upvotes: 1

Related Questions