Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
Developer Community or GitHub with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
Created attachment 14816 [details]
style.xml can't be used
<package id="Xamarin.Forms" version="184.108.40.20608-pre3" targetFramework="monoandroid60" />
Compile using Android version: Use Latest Platform (Android 6.0 Marshmallow)
Minimum Android to target; Android 4.0.3 (API Level 15)
Target Android version: Use Compile using SDK version
Compiling this on VS2015 / Win10
Xamarin 220.127.116.11 (413372c)
Xamarin.Android 18.104.22.168 (e98e962)
Application errors out on launch at LoadApplication(new App()); in MainActivity.cs with the following error:
01-31 07:07:08.315 I/MonoDroid(26231): UNHANDLED EXCEPTION:
01-31 07:07:08.315 I/MonoDroid(26231): System.NullReferenceException: Object reference not set to an instance of an object
01-31 07:07:08.315 I/MonoDroid(26231): at Xamarin.Forms.Platform.Android.Platform.UpdateActionBarHomeAsUp (Android.App.ActionBar actionBar) [0x0001d] in <filename unknown>:0
01-31 07:07:08.315 I/MonoDroid(26231): at Xamarin.Forms.Platform.Android.Platform.HideActionBar () [0x0000d] in <filename unknown>:0
01-31 07:07:08.315 I/MonoDroid(26231): at Xamarin.Forms.Platform.Android.Platform.UpdateActionBar () [0x000a0] in <filename unknown>:0
01-31 07:07:08.315 I/MonoDroid(26231): at Xamarin.Forms.Platform.Android.Platform.SetPage (Xamarin.Forms.Page newRoot) [0x000bd] in <filename unknown>:0
01-31 07:07:08.315 I/MonoDroid(26231): at Xamarin.Forms.Platform.Android.FormsApplicationActivity.InternalSetPage (Xamarin.Forms.Page page) [0x000b7] in <filename unknown>:0
01-31 07:07:08.315 I/MonoDroid(26231): at Xamarin.Forms.Platform.Android.FormsApplicationActivity.SetMainPage () [0x0000c] in <filename unknown>:0
01-31 07:07:08.315 I/MonoDroid(26231): at Xamarin.Forms.Platform.Android.FormsApplicationActivity.LoadApplication (Xamarin.Forms.Application application) [0x0002d] in <filename unknown>:0
01-31 07:07:08.325 I/MonoDroid(26231): at App23.Droid.MainActivity.OnCreate (Android.OS.Bundle bundle) [0x00020] in C:\Users\xyz\Documents\Visual Studio 2015\Projects\App23\App23\App23.Droid\MainActivity.cs:24
01-31 07:07:08.325 I/MonoDroid(26231): at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (IntPtr jnienv, IntPtr native__this, IntPtr native_savedInstanceState) [0x00011] in /Users/builder/data/lanes/2692/e98e9627/source/monodroid/src/Mono.Android/platforms/android-23/src/generated/Android.App.Activity.cs:2857
01-31 07:07:08.325 I/MonoDroid(26231): at (wrapper dynamic-method) System.Object:0d4ea3af-d627-4c79-af83-fd09d236a7f1 (intptr,intptr,intptr)
01-31 07:07:08.335 W/art (26231): JNI RegisterNativeMethods: attempt to register 0 native methods for md52ce486a14f4bcd95899665e9d932190b.JavaProxyThrowable
I noticed Xamarin.Android works fine, so this must be a Forms issue.
Please see repro.
Also created a thread: http://forums.xamarin.com/discussion/60091/updating-xamarin-to-the-latest-stable-seems-to-have-broken-android-custom-styles-for-xf#latest
This issue is happening on both Visual Studio and Xamarin Studio.
I rolled back to the following versions, however the issue still persists:
Based on the stack trace, I'm going to surmise that the exception happens because Activity.ActionBar is null.
Based on that assumption, observe $ANDROID_SDK_PATH/platforms/android-23/data/res/values/themes.xml:
<!-- ... -->
<!-- ... -->
<!-- Default theme with an Action Bar. -->
i.e. the default android:Theme resource does NOT support the ActionBar, and thus (I assume) Activity.ActionBar returns null.
If you need the action bar -- and presumably Xamarin.Forms requires the action bar -- then use a style which supports it:
<style name="MyTheme" parent="android:Theme.WithActionBar">
Please try that.
Jonathan, I do not need the action bar or the status bar. I want to go full screen. If, however, Xamarin Forms requires an ActionBar, then I can use another theme and hide it programmatically at startup. I'll try your suggestion later today and get back with you. I remember android:Theme working for me before I upgraded Xamarin. I just can't remember what version of Xamarin I was using before.
Theme.WithActionBar did not work for me. I think the problem is using any theme throws an error. Did you test run the repro I submitted? Did it work for you? Please suggest a reason as to why this bug's status was changed to "NEEDINFO".
Please suggest a reason as to why this bug's status was changed to "NEEDINFO". I'd like to understand if my repro is producible on your end.
I noticed the problem is with these two lines:
These are throwing the exception whether I set my theme to android:Theme or android:Theme.WithActionBar. They used to work before.
This could be closed as I figured out a way to hide the title bar properly. I believe I was approaching things from the wrong perspective.