When including AppCompat v7 in a Xamarin.Forms project, I get the crash below when opening the app. My target SDK version is 21. If I change the theme the xml inherits from to Holo instead of AppCompat, no problems. Any help or suggestions?
The styles definition
<?xml version="1.0" encoding="UTF-8" ?>
<resources>
<style name="MyTheme" parent="@style/Theme.AppCompat.Light">
</style>
</resources>
The main activity
[Activity (Theme = "@style/MyTheme", Label = "My App", ScreenOrientation = Android.Content.PM.ScreenOrientation.Portrait)]
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsApplicationActivity
{
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
global::Xamarin.Forms.Forms.Init (this, bundle);
LoadApplication (new App ());
}
}
The error
System.NullReferenceException: Object reference not set to an instance of an object
at at Xamarin.Forms.Platform.Android.MasterDetailRenderer.SetElement (Xamarin.Forms.VisualElement) <IL 0x000a0, 0x00404>
at at Xamarin.Forms.Platform.Android.RendererFactory.GetRenderer (Xamarin.Forms.VisualElement) <IL 0x00022, 0x0014f>
at at Xamarin.Forms.Platform.Android.Platform.AddChild (Xamarin.Forms.VisualElement,bool) <IL 0x00016, 0x000cb>
at at Xamarin.Forms.Platform.Android.Platform.SetPage (Xamarin.Forms.Page) <IL 0x00093, 0x0051f>
at at Xamarin.Forms.Platform.Android.FormsApplicationActivity.InternalSetPage (Xamarin.Forms.Page) <IL 0x000be, 0x0053b>
at at Xamarin.Forms.Platform.Android.FormsApplicationActivity.SetMainPage () <IL 0x0000c, 0x00077>
at at Xamarin.Forms.Platform.Android.FormsApplicationActivity.LoadApplication (Xamarin.Forms.Application) <IL 0x00034, 0x001c3>
at MyApp.Droid.MainActivity.OnCreate (Android.OS.Bundle) [0x00015] in /Users/chasebrammer/Projects/MyApp/Droid/MainActivity.cs:22
at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (intptr,intptr,intptr) [0x00011] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.20-series/ba9bbbdd/source/monodroid/src/Mono.Android/platforms/android-16/src/generated/Android.App.Activity.cs:2089
at at (wrapper dynamic-method) object.e664bb63-0f46-429a-9d4b-6d0c65f51629 (intptr,intptr,intptr) <IL 0x00017, 0x0004b>
Just showing what components I have added