Bug 60810 - Forms isn't compatible with Android 6 projects
Summary: Forms isn't compatible with Android 6 projects
Alias: None
Product: Forms
Classification: Xamarin
Component: Android ()
Version: 2.5.0
Hardware: Macintosh Mac OS
: --- critical
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2017-11-22 12:34 UTC by David Britch
Modified: 2017-12-04 15:14 UTC (History)
6 users (show)

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

Sample (50.90 KB, application/zip)
2017-11-22 12:34 UTC, David Britch

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 David Britch 2017-11-22 12:34:53 UTC
Created attachment 25798 [details]

If you create a Forms project, using the latest release, that targets Android 6, a build error results.

This repos in both VSMac and VS2017 (both the latest stable releases). Sample attached (produced in VSMac)

Repo steps:

1. Create a PCL-based Forms project.
2. Remove all the NuGet packages from the Android project.
3. Set the Android project to target Android 6.0. (It may then be necessary to close/re-open the solution.)
4. Add Forms to the Android project.
5. (optional) Update Forms in the PCL project.
6. Build the Android project.

Expected result: Project builds with zero errors.

Actual result: Projects fails to build, with one error:

/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2,2): Error: Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly 'Xamarin.Android.Support.Fragment, Version=, Culture=neutral, PublicKeyToken='. Perhaps it doesn't exist in the Mono for Android profile?
File name: 'Xamarin.Android.Support.Fragment.dll'
  at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference reference, Mono.Cecil.ReaderParameters parameters) [0x00099] in /Users/builder/data/lanes/5147/c2a33d8e/source/xamarin-android/external/Java.Interop/src/Java.Interop.Tools.Cecil/Java.Interop.Tools.Cecil/DirectoryAssemblyResolver.cs:220 
  at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference reference) [0x00000] in /Users/builder/data/lanes/5147/c2a33d8e/source/xamarin-android/external/Java.Interop/src/Java.Interop.Tools.Cecil/Java.Interop.Tools.Cecil/DirectoryAssemblyResolver.cs:170 
  at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences (Java.Interop.Tools.Cecil.DirectoryAssemblyResolver resolver, System.Collections.Generic.ICollection`1[T] assemblies, Mono.Cecil.AssemblyDefinition assembly, System.Boolean topLevel) [0x0015c] in <593a6fd557984367bb21e275d0fa0659>:0 
  at Xamarin.Android.Tasks.ResolveAssemblies.Execute (Java.Interop.Tools.Cecil.DirectoryAssemblyResolver resolver) [0x0019c] in <593a6fd557984367bb21e275d0fa0659>:0  (test.Droid)
Comment 1 Gustavo 2017-11-28 17:27:20 UTC
Same problem.

Xamarin.Android.Support.Fragment isn't compatible with Android 6.0, but compilation demands that library.
Comment 2 Jason Smith [MSFT] 2017-11-29 18:18:05 UTC
You need to use the 23.3.0 version of the support libraries if you are not using MonoAndroid70 or higher as your target framework. The packages are not compatible with the older android frameworks.
Comment 3 raV720 2017-11-30 10:52:17 UTC
Same problem. Using version 23.3.0 of the support libraries does not solve problem.
Comment 4 David Britch 2017-11-30 14:43:43 UTC
I'm re-opening this bug. The sample I attached to the original report already uses v23.3.0 of the support libs and doesn't build in VSMac (latest stable build).
Comment 5 David Ortinau [MSFT] 2017-11-30 22:24:07 UTC
Ok, we're updating the release notes to reflect this change. 

In updating Maps and AppLinks to use the updated Firebase, the dependencies were bumped to Android Framework 7+ and Android Support Libraries

Your projects may still target the same APIs as they do presently.

So for the provided solution project I updated the Android Framework to 7.0 and updated the Android Support Libraries to, and I've confirmed it builds and runs successfully.