Xamarin.Auth: Error building Xamarin.Forms (Android) app with Linker: CustomTabs
When building an Android app made with Xamarin.Forms 2.3.4.224 and Linker enabled, we get an error related to Android Support CustomTabs:
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets:
Error: Error executing task LinkAssemblies: error XA2006: Could not resolve reference to 'Android.Support.CustomTabs.CustomTabsClient/ExtraCallbackDelegate'
(defined in assembly 'Xamarin.Auth, Version=1.3.0.0, Culture=neutral, PublicKeyToken=null') with scope 'Xamarin.Android.Support.CustomTabs, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
When the scope is different from the defining assembly, it usually means that the type is forwarded. (MyApp.Droid)
This does not happen when you build with linker off. I believe this is caused by a higher dependency of CustomTabs needed for Xamarin.Auth (25.1.1) than I have in my project (23.3.0). The problem is that this newer version is not compatible with any Xamarin.Forms project at the moment, because Xamarin.Forms have a hard dependency on Support Libraries, they must be exactly 23.3.0, and updating CustomTabs would require newer versions of the support libraries.
Does Xamarin.Auth really need a higher dependency? Can’t it use an older version (>= 23.3.0) to make it more compatible with Xamarin.Forms?
Relevant packages used: Xamarin.Auth 1.4.1.0 Xamarin.Forms 2.3.4.224 Xamarin.Android.Support.CustomTabs 23.3.0
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 33 (4 by maintainers)
Still have this linker issue with version 1.6.0-alpha03 and 1.6.0-alpha04. The fix is to explicitly install Xamarin.Android.Support.CustomTabs nuget. By default, Xamarin.Auth resolved to 23.3.0 and that cased the issue. I manually installed current latest version (26.1.0.1) and the issue is gone.
Hello, I still have this issue with version 1.5.0. Just bumped my Xamarin.Forms version to 2.3.4.247 and getting:
The “LinkAssemblies” task failed unexpectedly. Java.Interop.Tools.Diagnostics.XamarinAndroidException: error XA2006: Could not resolve reference to ‘System.Void Android.Support.CustomTabs.CustomTabsIntent::LaunchUrl(Android.Content.Context,Android.Net.Uri)’ (defined in assembly 'Xamarin.Auth, … "
when I try to build in Release. Works in debug.
Any ideas?
/Ferenczi