Bug 60197 - Build.Serial throws an exception on < API 26
Summary: Build.Serial throws an exception on < API 26
Status: RESOLVED DUPLICATE of bug 60069
Alias: None
Product: Android
Classification: Xamarin
Component: Android+BCL Integration ()
Version: 8.0 (15.4)
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Marek Habersack
Depends on:
Reported: 2017-10-15 22:06 UTC by Jim Bennett
Modified: 2017-10-15 23:30 UTC (History)
2 users (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:

Description Jim Bennett 2017-10-15 22:06:09 UTC
The underlying Java implementation for Android.OSBuild.Serial has changed from a field called SERIAL to a getSerial method. Unfortunately both implementations map to a C# property called Serial meaning the old API has been replaced. If you call Serial on an app build using API 26 on a device running API25 or less you get a missing method exception.

There is no workaround as the pre-26 SERIAL field is no longer available, you have to access it via reflection:

if (Build.VERSION.SdkInt >= BuildVersionCodes.O)
    serial = Build.Serial;
    var field = Java.Lang.Class.FromType(typeof(Build)).GetField("SERIAL");
    serial = field.Get(null).ToString();
Comment 1 Jon Douglas [MSFT] 2017-10-15 23:30:10 UTC
This is fixed in upcoming 15.4 and 15.5 builds. I'm marking this as a duplicate. Thanks for the report!

*** This bug has been marked as a duplicate of bug 60069 ***