This is a migrated thread and some comments may be shown as answers.

Error resolving reference in Android build

5 Answers 287 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
RJP
Top achievements
Rank 1
RJP asked on 12 Feb 2019, 09:38 AM

We are using Telerik purely for the RadSideDrawer, and have referenced Telerik.UI.for.xamarin.lite.

According to the documentation, should not need any SkiSharp reference for this as its only the 'lite' version.

Yet when build with the release version with the Android Linking set to "SDK assemblies only" we get the following build error:

SeverityCodeDescriptionProjectFileLineSuppression State
ErrorThe "LinkAssemblies" task failed unexpectedly.
Java.Interop.Tools.Diagnostics.XamarinAndroidException: error XA2006: Could not resolve reference to 'Telerik.XamarinForms.SkiaSharp.StrokeKey' (defined in assembly 'Telerik.XamarinForms.PdfViewer, Version=2019.1.131.340, Culture=neutral, PublicKeyToken=null') with scope 'Telerik.XamarinForms.SkiaSharp, Version=2019.1.131.340, Culture=neutral, PublicKeyToken=null'. When the scope is different from the defining assembly, it usually means that the type is forwarded. ---> Mono.Cecil.ResolutionException: Failed to resolve Telerik.XamarinForms.SkiaSharp.StrokeKey
   at Mono.Linker.Steps.MarkStep.HandleUnresolvedType(TypeReference reference)
   at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference)
   at MonoDroid.Tuner.MonoDroidMarkStep.MarkType(TypeReference reference)
   at Mono.Linker.Steps.MarkStep.MarkGenericArguments(IGenericInstance instance)
   at Mono.Linker.Steps.MarkStep.GetOriginalType(TypeReference type)
   at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference)
   at MonoDroid.Tuner.MonoDroidMarkStep.MarkType(TypeReference reference)
   at Mono.Linker.Steps.MarkStep.MarkField(FieldReference reference)
   at Mono.Linker.Steps.MarkStep.InitializeFields(TypeDefinition type)
   at Mono.Linker.Steps.MarkStep.InitializeType(TypeDefinition type)
   at Mono.Linker.Steps.MarkStep.InitializeAssembly(AssemblyDefinition assembly)
   at Mono.Linker.Steps.MarkStep.Initialize()
   at MonoDroid.Tuner.MonoDroidMarkStep.Process(LinkContext context)
   at Mono.Linker.Pipeline.Process(LinkContext context)
   at MonoDroid.Tuner.Linker.Process(LinkerOptions options, ILogger logger, LinkContext& context)
   at Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res)
   --- End of inner exception stack trace ---
   at Java.Interop.Tools.Diagnostics.Diagnostic.Error(Int32 code, Exception innerException, String message, Object[] args)
   at Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res)
   at Xamarin.Android.Tasks.LinkAssemblies.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()PortableClient.Droid

5 Answers, 1 is accepted

Sort by
0
RJP
Top achievements
Rank 1
answered on 12 Feb 2019, 10:49 AM

A similar thing occurs in the iOS build if you have linking set to "SDK assemblies" rather than "no link". Except this is an error referencing string.split (again, for a control that we don't actually use).

Since turning off the linking results in a much larger output file, this is of concern.

0
Yana
Telerik team
answered on 12 Feb 2019, 03:41 PM
Hi Ricky,

Indeed, the first reported error on Android is an issue on our side, I have logged it in the public portal, you could track its status at the link below:
https://feedback.telerik.com/xamarin/1387570-compilation-error-is-thrown-when-using-lite-telerik-ui-for-xamarin-nuget

We'll look into it at the earliest convenience.

As a workaround, you could reference the needed nuget packages separately, in the concrete case Telerik.UI.for.Xamarin.Primitives.Lite and Telerik.UI.for.Xamarin.Common.

As to the second issue on iOS - we've been reported similar error and it was related to an older version of Visual Studio, could you let me know the version you're using?

I am looking forward to your reply.

Regards,
Yana
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
RJP
Top achievements
Rank 1
answered on 12 Feb 2019, 03:53 PM

Hi,

We are using Visual Studio 2017 (version 15.8.9).

For the iOS issue I have since realised that you can also avoid the error by setting the linker behaviour to "Link all". This approach doesn't work with the Android build though (it just produces slightly different referencing errors).

I will give your other workaround a go at the earliest opportunity.

0
RJP
Top achievements
Rank 1
answered on 13 Feb 2019, 08:56 AM

Hi,

For the Android version, adding the packages for Telerik.UI.for.Xamarin.Common and Primitives.Lite did not work. If I do a release build with link mode set to "SDK Assemblies" it still produces the same error. I also upgraded to the latest 2019.1.211.340 build, which I noticed had appeared, but this didn't make any difference either.

 

For the iOS build, with linking set to "Link framework SDK only", the full error is:

C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(795,3): error MT2101: Can't resolve the reference 'System.String[] System.String::Split(System.Char,System.StringSplitOptions)', referenced from the method 'System.Void Telerik.XamarinForms.Common.PlatformCulture::.ctor(System.String)' in 'mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'.

 

 

0
Yana
Telerik team
answered on 13 Feb 2019, 09:18 AM
Hello Ricky,

Regarding the issue on Android - we'll provide a fix in the next minor release of Telerik UI for Xamarin, expected in about 2 weeks, please follow the feedback item to receive an email notification as soon as it is resolved.  In the meantime, you could use the full assembly, just not to block your development.

I hope the timeframe would be acceptable, let me know if you have any concerns regarding this.

As to the iOS issue -  that's exactly the same error we've been reported before and it was resolved with the upgrade of Visual Studio to 15.9.  Is it possible for you to upgrade?

I am looking forward to your reply.

Regards,
Yana
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
General Discussions
Asked by
RJP
Top achievements
Rank 1
Answers by
RJP
Top achievements
Rank 1
Yana
Telerik team
Share this question
or