RestrictedCaptionAreaChangedEventArgs could not be resolved

I've just upgraded a Xamarin application to use the latest ReactiveUI 7.0.0 and got the following error when building in release mode:

error MSB4018: Java.Interop.Tools.Diagnostics.XamarinAndroidException: error XA2006: Reference to metadata item 'Android.Views.Window/RestrictedCaptionAreaChangedEventArgs' (defined in 'ReactiveUI.Events, Version=7.0.0.0, Culture=neutral, PublicKeyToken=null') from 'ReactiveUI.Events, Version=7.0.0.0, Culture=neutral, PublicKeyToken=null' could not be resolved. ---> Mono.Cecil.ResolutionException: Failed toresolve Android.Views.Window/RestrictedCaptionAreaChangedEventArgs

 RestrictedCaptionAreaChangedEventArgs was added in Xamarin Android 7.0 and is part of the API level 24 changes.

I needed to first install the Android SDK tools for API Level 24.  Open the Android SDK Manager and select 'Android SDK Build-tools' v24.0.3, 'SDK Platform Android 7.0' and 'ARM EABI v7a System Image'.


Then in my project properties I updated the 'Compile using Android version' and 'Target Android version' properties on the Application tab.

If you then get 'java.lang.UnsupportedClassVersionError: com/android/dx/command/Main : Unsupported major.minor version 52.0', all you need to do is install the JDK 1.8 and update your JDK location in 'Tools\Options\Xamarin\Android settings'

Post a Comment