xamarin / Xamarin.Forms

Xamarin.Forms is no longer supported. Migrate your apps to .NET MAUI.
https://aka.ms/xamarin-upgrade
Other
5.64k stars 1.88k forks source link

[Bug] Lottie package throwing error while creating the release build in Android after switching to target framework 13 #15844

Closed Alexander-Mathew closed 7 months ago

Alexander-Mathew commented 7 months ago

While trying to release the application in Android after switching the target framework to 13 getting Lottie package error.

Expected Behavior

Release build should succeed

Actual Behavior

BUILD ERROR /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Legacy.targets(5,5): Error XALNK7000: Mono.Linker.MarkException: Error processing method: 'AndroidX.Collection.SparseArrayCompat Com.Airbnb.Lottie.LottieComposition::get_Characters()' in assembly: 'Lottie.Android.dll' ---> Mono.Cecil.ResolutionException: Failed to resolve AndroidX.Collection.SparseArrayCompat

Basic Information

Environment

Visual Studio Community 2022 for Mac Version 17.6.7 (build 417) Installation UUID: 209c1efa-cbf9-477b-ad1d-6b15f7fedfb4

Runtime .NET 7.0.3 (64-bit) Architecture: Arm64 Microsoft.macOS.Sdk 13.1.1007; git-rev-head:8afca776a0a96613dfb7200e0917bb57f9ed5583; git-branch:release/7.0.1xx-xcode14.2

Roslyn (Language Service) 4.6.0-3.23180.6+99e956e42697a6dd886d1e12478ea2b27cceacfa

NuGet Version: 6.4.0.117

.NET SDK (Arm64) SDK: /usr/local/share/dotnet/sdk/7.0.311/Sdks SDK Versions: 7.0.311 7.0.308 7.0.307 7.0.304 6.0.417 6.0.414 6.0.413 6.0.410 MSBuild SDKs: /Applications/Visual Studio.app/Contents/MonoBundle/MSBuild/Current/bin/Sdks

.NET Runtime (Arm64) Runtime: /usr/local/share/dotnet/dotnet Runtime Versions: 7.0.14 7.0.11 7.0.10 7.0.7 6.0.25 6.0.22 6.0.21 6.0.18

Xamarin.Android Version: 13.2.2.0 (Visual Studio Community) Commit: xamarin-android/d17-5/45b0e14 Android SDK: /Users/alexandermathew/Library/Developer/Xamarin/android-sdk-macosx Supported Android versions: 12.1 (API level 32) 12.0 (API level 31) 11.0 (API level 30) 10.0 (API level 29) 9.0 (API level 28) 13.0 (API level 33)

SDK Command-line Tools Version: 7.0 SDK Platform Tools Version: 34.0.3 SDK Build Tools Version: 32.0.0

Build Information: Mono: d9a6e87 Java.Interop: xamarin/java.interop/d17-5@149d70fe SQLite: xamarin/sqlite/3.40.1@68c69d8 Xamarin.Android Tools: xamarin/xamarin-android-tools/d17-5@ca1552d

Microsoft Build of OpenJDK Java SDK: /Library/Java/JavaVirtualMachines/microsoft-11.jdk 11.0.16.1 Android Designer EPL code available here: https://github.com/xamarin/AndroidDesigner.EPL

Eclipse Temurin JDK Java SDK: /Library/Java/JavaVirtualMachines/temurin-8.jdk 1.8.0.302 Android Designer EPL code available here: https://github.com/xamarin/AndroidDesigner.EPL

Android SDK Manager Version: 17.6.0.50 Hash: a715dca Branch: HEAD Build date: 2023-11-10 12:19:52 UTC

Build Logs

/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Legacy.targets(5,5): Error XALNK7000: Mono.Linker.MarkException: Error processing method: 'AndroidX.Collection.SparseArrayCompat Com.Airbnb.Lottie.LottieComposition::get_Characters()' in assembly: 'Lottie.Android.dll' ---> Mono.Cecil.ResolutionException: Failed to resolve AndroidX.Collection.SparseArrayCompat

at Mono.Linker.Steps.MarkStep.HandleUnresolvedType (Mono.Cecil.TypeReference reference) [0x00013] in <43053c0ed9b14666903c480c1357d840>:0 at Mono.Linker.Steps.MarkStep.MarkType (Mono.Cecil.TypeReference reference) [0x0002c] in <43053c0ed9b14666903c480c1357d840>:0 at MonoDroid.Tuner.MonoDroidMarkStep.MarkType (Mono.Cecil.TypeReference reference) [0x00000] in <43053c0ed9b14666903c480c1357d840>:0 at Mono.Linker.Steps.MarkStep.ProcessMethod (Mono.Cecil.MethodDefinition method) [0x0016c] in <43053c0ed9b14666903c480c1357d840>:0 at Mono.Linker.Steps.MarkStep.ProcessQueue () [0x0001b] in <43053c0ed9b14666903c480c1357d840>:0 --- End of inner exception stack trace --- at Mono.Linker.Steps.MarkStep.ProcessQueue () [0x00047] in <43053c0ed9b14666903c480c1357d840>:0 at Mono.Linker.Steps.MarkStep.ProcessPrimaryQueue () [0x0000a] in <43053c0ed9b14666903c480c1357d840>:0 at Mono.Linker.Steps.MarkStep.Process () [0x000f6] in <43053c0ed9b14666903c480c1357d840>:0 at Mono.Linker.Steps.MarkStep.Process (Mono.Linker.LinkContext context) [0x0000d] in <43053c0ed9b14666903c480c1357d840>:0 at MonoDroid.Tuner.MonoDroidMarkStep.Process (Mono.Linker.LinkContext context) [0x0000b] in <43053c0ed9b14666903c480c1357d840>:0 at Mono.Linker.Pipeline.ProcessStep (Mono.Linker.LinkContext context, Mono.Linker.Steps.IStep step) [0x0000d] in <43053c0ed9b14666903c480c1357d840>:0 at Mono.Linker.Pipeline.Process (Mono.Linker.LinkContext context) [0x0000f] in <43053c0ed9b14666903c480c1357d840>:0 at MonoDroid.Tuner.Linker.Run (Mono.Linker.Pipeline pipeline, Mono.Linker.LinkContext context) [0x00000] in <43053c0ed9b14666903c480c1357d840>:0 at MonoDroid.Tuner.Linker.Process (MonoDroid.Tuner.LinkerOptions options, Mono.Linker.ILogger logger, Mono.Linker.LinkContext& context) [0x00071] in <43053c0ed9b14666903c480c1357d840>:0 at Xamarin.Android.Tasks.LinkAssemblies.Execute (Java.Interop.Tools.Cecil.DirectoryAssemblyResolver res) [0x0018f] in <43053c0ed9b14666903c480c1357d840>:0 at Xamarin.Android.Tasks.LinkAssemblies.RunTask () [0x0001b] in <43053c0ed9b14666903c480c1357d840>:0 at Microsoft.Android.Build.Tasks.AndroidTask.Execute () [0x00000] in /Users/runner/work/1/s/xamarin-android/external/xamarin-android-tools/src/Microsoft.Android.Build.BaseTasks/AndroidTask.cs:17 (XALNK7000) (AppName.Android)

jfversluis commented 7 months ago

I see a way old Xamarin.Forms version in there so you might want to try and update that first. As well as dependencies. Additionally I think this might be a bug in the Lottie library and not so much in Xamarin.Forms.

If after all that you still think this is a Xamarin.Forms issue, please open a new issue with all the updated details. Thanks!