Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

Adding Android Theme Causes Crash

$
0
0

Hi All,

When I add a Theme to the Android build of my project, it crashes.

When I change my Activity from this:

[Activity (Label = "AppName", MainLauncher = true)]

to this:

[Activity (Label = "AppName", MainLauncher = true, Theme = "@style/Theme.Base")]

styles.xml:

<?xml version="1.0" encoding="UTF-8" ?>
<resources>
<style name="Theme.Base" parent="android:Theme.Holo.Light" />
</resources>

I get the same error in Forms 1.2.2, 1.2.3-pre1, and 1.2.3-pre2:

System.Diagnostics.Debugger.Mono_UnhandledException_internal () in
System.Diagnostics.Debugger.Mono_UnhandledException (ex={System.NullReferenceException: Object reference not set to an instance of an object
at Xamarin.Forms.Platform.Android.Platform.UpdateActionBarBackgroundColor ()
at Xamarin.Forms.Platform.Android.Platform.set_CurrentNavigationPage (Xamarin.Forms.NavigationPage)
at Xamarin.Forms.Platform.Android.Platform.UpdateActionBar ()
at Xamarin.Forms.Platform.Android.Platform.SetPage (Xamarin.Forms.Page)
at Xamarin.Forms.Platform.Android.AndroidActivity.SetPage (Xamarin.Forms.Page)
at AppName.Android.MainActivity.OnCreate (Android.OS.Bundle) [0x0001f] in /Unity/AppName/Android/MainActivity.cs:27
at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (intptr,intptr,intptr) [0x00011] in /Users/builder/data/lanes/1131/62e09eb0/source/monodroid/src/Mono.Android/platforms/android-19/src/generated/Android.App.Activity.cs:2179
at (wrapper dynamic-method) object.bc84db96-f579-4b9d-a183-38e0ae62b158 (intptr,intptr,intptr)
}) in
object.bc84db96-f579-4b9d-a183-38e0ae62b158 (arg0=0x2a008470, arg1=0xfffffffff3b00019, arg2=0x0) in
Xamarin.Forms.Platform.Android.Platform.UpdateActionBarBackgroundColor () in
Xamarin.Forms.Platform.Android.Platform.set_CurrentNavigationPage (value={Xamarin.Forms.NavigationPage}) in
Xamarin.Forms.Platform.Android.Platform.UpdateActionBar () in
Xamarin.Forms.Platform.Android.Platform.SetPage (newRoot={Xamarin.Forms.NavigationPage}) in
Xamarin.Forms.Platform.Android.AndroidActivity.SetPage (page={Xamarin.Forms.NavigationPage}) in
AppName.Android.MainActivity.OnCreate (bundle=(null)) in /Unity/AppName/Android/MainActivity.cs:27
Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (jnienv=0x2a008470, native__this=0xfffffffff3b00019, native_savedInstanceState=0x0) in /Users/builder/data/lanes/1131/62e09eb0/source/monodroid/src/Mono.Android/platforms/android-19/src/generated/Android.App.Activity.cs:2179
object.bc84db96-f579-4b9d-a183-38e0ae62b158 (arg0=0x2a008470, arg1=0xfffffffff3b00019, arg2=0x0) in

Has anyone encountered this before? Any help would be appreciated!


Viewing all articles
Browse latest Browse all 77050

Trending Articles