Xamarin.Android 8.4 (Preview)

Last Update 5/31/2018

System Requirements | What's New | Known Issues | Blogs | Open Source

Installing

Feedback

Your feedback is important to us. If there are any problems with this release, check our GitHub Issues, Xamarin.Android Community Forums and Visual Studio Developer Community for existing issues. For new issues within the Xamarin.Android SDK, please report a GitHub Issue. For general Xamarin.Android experience issues, let us know via the Report a Problem option found in your favorite IDE via Help -> Report a Problem.

Release History

You can learn more about how we ship our releases in the Visual Studio 2017 Release Rhythm document.

May 31st, 2018 - Xamarin.Android 8.3.99.12

This version is included in the Visual Studio 2017 version 15.8 preview 2 release.

Issues Fixed
  • Bugzilla 7505 FileNotFoundException when probing assemblies should provide more context.
  • Bugzilla 59046 Bindings Generator fails with [ERROR] FATAL UNHANDLED EXCEPTION: System.ArgumentNullException: Value cannot be null.
  • GitHub 1374 Xamarin Android Lint checks fail on Windows when ran against a very simple app
  • GitHub 1400 BCL test 'TaskSchedulerTests.GetTaskSchedulersForDebugger_ReturnsDefaultScheduler' fails when the linker is enabled.
  • GitHub 1511 Unstable framework versions are used when $(AndroidUselatestPlatformSDK)=true
  • GitHub 1519 Deploying to Android fails with zipalign error
  • GitHub 1532 Error: Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly 'Microsoft.Azure.Services.AppAuthentication, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Perhaps it doesn't exist in the Mono for Android profile?
  • GitHub 1541 Aapt2 Task fails with Error Access to the path 'obj\Debug\monoandroid81\android\src' is denied.
  • GitHub 1642 ValidateJavaVersion should check both java and javac version
  • GitHub 1652 Links against ABI-unstable system Mono.Cecil
  • GitHub 1669 Getting build failure for Cheesesquare sample in both debug and release mode
Integrated Mono Features/Fixes

Xamarin.Android uses Mono 5.12 Commit 93e3dafc

What's New in this Release

Android P Developer Preview 1

We’re excited to announce Xamarin.Android support for Android P Developer Preview 1. Android P introduces new features including display cutout support, notification enhancements, multi-camera support, AnimatedImageDrawable and much more. Be on the look-out in future Visual Studio Previews for Xamarin.Android support of Android P Developer Preview 2 and Developer Preview 3. For more information about the release cycle of Android P Preview, read about the Android P Preview Program Overview.

Bindings and Code-Behind

To make Android development more pleasant when working with Android Resources, we've provided two new features known as bindings and code-behind.

Bindings

Bindings generates a class per each Android layout file which contains strongly typed properties for all of the Android Resource Ids in the layout file. This allows you to instantiate a new Binding to then access your respective View classes in your resource file without calling FindViewById().

For example, take the following layout file:

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:xamarin="http://schemas.xamarin.com/android/xamarin/tools">
  <Button android:id="@+id/myButton" />
  <fragment
      android:id="@+id/log_fragment"
      android:name="commonsamplelibrary.LogFragment"
      xamarin:managedType="CommonSampleLibrary.LogFragment"
  />
  <fragment
      android:id="@+id/secondary_log_fragment"
      android:name="CommonSampleLibrary.LogFragment"
  />
</LinearLayout>

You would then access the binding in your Activity to provide your Views:

partial class MainActivity : Activity {
  protected override void OnCreate (Bundle savedInstanceState)
  {
    base.OnCreate (savedInstanceState);

    SetContentView (Resource.Layout.Main);
    var binding     = new Binding.Main (this);
    Button button   = binding.myButton;
    button.Click   += delegate {
        button.Text = $"{count++} clicks!";
    };
  }
}
Code-Behind

Code-behind generates a partial class that contains strongly typed properties for all of the Android Resource Ids in the layout file. Code-behind builds on-top of the Binding mechanism in which you can opt-in to Code-Behind generation using our new xamarin:classes XML attribute which is a ; separated list of full class names to be generated.

For example, take the following layout file:

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:xamarin="http://schemas.xamarin.com/android/xamarin/tools"
    xamarin:classes="Example.MainActivity">
  <Button android:id="@+id/myButton" />
  <fragment
      android:id="@+id/log_fragment"
      android:name="commonsamplelibrary.LogFragment"
      xamarin:managedType="CommonSampleLibrary.LogFragment"
  />
  <fragment
      android:id="@+id/secondary_log_fragment"
      android:name="CommonSampleLibrary.LogFragment"
  />
</LinearLayout>

You would then access Views in your Activity directly:

partial class MainActivity : Activity {
  protected override void OnCreate (Bundle savedInstanceState)
  {
    base.OnCreate (savedInstanceState);

    SetContentView (Resource.Layout.Main);

    myButton.Click += delegate {
        button.Text = $"{count++} clicks!";
    };
  }
}

For more information about this feature, please see our documentation here: https://github.com/xamarin/xamarin-android/blob/master/Documentation/guides/LayoutCodeBehind.md

OSS Core

Xamarin.Android 8.4 is based on the open-source Xamarin.Android repositories:

Xamarin Workbook

If it's not already installed, install the Xamarin Workbooks app first. The workbook file should download automatically, but if it doesn't, just click to start the workbook download manually.