Bug 21961 - HelloTabsICS throwing NRE on launch
Summary: HelloTabsICS throwing NRE on launch
Status: VERIFIED FIXED
Alias: None
Product: Android
Classification: Xamarin
Component: General ()
Version: 4.16.0
Hardware: Macintosh Mac OS
: High blocker
Target Milestone: 4.16.0
Assignee: Jonathan Pryor
URL:
: 21957 21965 ()
Depends on:
Blocks:
 
Reported: 2014-08-08 13:54 UTC by Peter Collins
Modified: 2014-08-12 13:32 UTC (History)
3 users (show)

Tags:
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:
Status:
VERIFIED FIXED

Description Peter Collins 2014-08-08 13:54:58 UTC
This is a regression from our stable XA 4.14, attempting to reference the ActionBar of an Activity returns null.

Steps to repro:
1. Create a new hello world template
2. Add the following code to your OnCreate method.
> var bar = this.ActionBar;

Logcat output:
https://gist.github.com/pjcollins/76e06eef5ecf12bfef0c

Environment:
OSX mavericks
Comment 1 Jonathan Pryor 2014-08-08 16:22:49 UTC
*** Bug 21957 has been marked as a duplicate of this bug. ***
Comment 2 Jonathan Pryor 2014-08-08 16:25:08 UTC
The problem is that Activity.ActionBar requires that //uses-sdk/@android:minSdkVersion be >= 11 in order to return a non-null value, and monodroid/bd3dc412 altered the minSdkVersion algorithm to always emit "4" (unless overridden in Properties\AndroidManifest.xml) INSTEAD OF $(TargetFrameworkVersion).

Meaning that ActionBar is now unusable in the default config.

Fixed in master/1c78098c and monodroid-4.16-series/280e58c0.
Comment 3 Jonathan Pryor 2014-08-08 16:29:41 UTC
*** Bug 21965 has been marked as a duplicate of this bug. ***
Comment 4 Danish Akhtar 2014-08-12 13:32:59 UTC
Today, I have checked this issue with following builds:
XS 5.3(build 421)
X.Android 4.16.0-10
ML 10.8.5
Device info: Samsung Note3 V 4.4.2

I have followed the steps mentioned in Bug description, after adding the line   var bar = this.ActionBar; in OnCreate method of Android template. Application is running successfully on device without any exception.

Hence closing this issue.