Bug 23955 - AcionBar wrapper null reference
Summary: AcionBar wrapper null reference
Alias: None
Product: Android
Classification: Xamarin
Component: Pre-release ()
Version: 4.18.0
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Jonathan Pryor
Depends on:
Reported: 2014-10-21 09:47 UTC by Iliass Yousfi
Modified: 2014-10-24 18:07 UTC (History)
1 user (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and 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 Links.

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.

Related Links:

Comment 1 Iliass Yousfi 2014-10-21 09:59:24 UTC
In addition, I added the support for the new material Design styling by adding 
values-v21 --> styles.xml which content is


        This theme completely replaces
        AppBaseTheme from res/values/styles.xml on API 21+ devices.
    <style name="AppBaseTheme" parent="android:Theme.Material.Light">
        <!-- API 21 theme customizations can go here. -->

Comment 2 Jonathan Pryor 2014-10-24 16:55:24 UTC
Within bugzilla, line wrapping may be disabled by starting a line with '> '. This results in more readable stack traces, as they won't be line wrapped.

Regarding the NullReferenceException from ActionBar.SetHomeButtonEnabled(), this is probably because ActionBar is null. ActionBar in turn can be null if, among other reasons, the //uses-sdk/@android:minSdkVersion attribute is less than 11.

Comment #0 clearly states that it isn't, but could you please check the contents of obj\*\android\AndroidManifest.xml and double-check the value of the //uses-sdk/@android:minSdkVersion attribute? Is there more than one <uses-sdk/> element?

There are a variety of reasons that Activity.getActionBar() would return null; //uses-sdk/@android:minSdkVersion is just one possibility.
Comment 3 Jonathan Pryor 2014-10-24 18:07:07 UTC
@Iliass: Apparently API-21 *disables* ActionBar when material design is used:


> we have removed a load of automatic features from the action bar
> when you use Theme.Material or appcompat:21

So this appears to be By Design/UPSTREAM.