Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AndroidX.Collection dependency error. #398

Closed
5 tasks
Taofeek-Allison opened this issue Dec 2, 2023 · 4 comments · Fixed by #399
Closed
5 tasks

AndroidX.Collection dependency error. #398

Taofeek-Allison opened this issue Dec 2, 2023 · 4 comments · Fixed by #399

Comments

@Taofeek-Allison
Copy link

🐛 Bug Report

Severity Code Description Project File Line Suppression State
Error 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(TypeReference reference)
at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference)
at MonoDroid.Tuner.MonoDroidMarkStep.MarkType(TypeReference reference)
at Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method)
at Mono.Linker.Steps.MarkStep.ProcessQueue()
--- End of inner exception stack trace ---
at Mono.Linker.Steps.MarkStep.ProcessQueue()
at Mono.Linker.Steps.MarkStep.ProcessPrimaryQueue()
at Mono.Linker.Steps.MarkStep.Process()
at Mono.Linker.Steps.MarkStep.Process(LinkContext context)
at MonoDroid.Tuner.MonoDroidMarkStep.Process(LinkContext context)
at Mono.Linker.Pipeline.ProcessStep(LinkContext context, IStep step)
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)
at Xamarin.Android.Tasks.LinkAssemblies.RunTask()
at Microsoft.Android.Build.Tasks.AndroidTask.Execute() in /Users/runner/work/1/s/xamarin-android/external/xamarin-android-tools/src/Microsoft.Android.Build.BaseTasks/AndroidTask.cs:line 17 ChartBuilder.XForms.Android

Expected behavior

Lotie package should be compatible with the latest AndroidX Libraries.

Reproduction steps

  1. Update AndroidX packages to the latest
  2. Build for release
  3. the app fails to build for release but builds for debug only.

Configuration

Version: 4.1.0

Platform:

  • 📱 iOS
  • [X ] 🤖 Android
  • 🏁 WPF
  • 🌎 UWP
  • 🍎 MacOS
  • 📺 tvOS
  • [X ] 🐒 Xamarin.Forms
@angularsen
Copy link
Contributor

angularsen commented Dec 8, 2023

Related:
dotnet/android-libraries#821
#397

angularsen added a commit to angularsen/LottieXamarin that referenced this issue Dec 9, 2023
Fixes Baseflow#398

Related:
Baseflow#397
dotnet/android-libraries#821

After upgrading AndroidX packages in our Xamarin Forms Android project, the linker fails on LottieXamarin using some outdated version of AndroidX types.

```
Error 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
```

### Changes
- Update `Xamarin.AndroidX.AppCompat` from 1.3.1.3 to 1.6.1.6
- Change Android target from monoandroid10.0 to monoandroid12.0 to support newest AndroidX package

### Notes
This needs some assistance to fit into the latest changes of `develop` with net6.0 / maui. I'm not sure if this is experimental or not, but I was not able to build it.

The PR is currently based on the commit prior to net6.0 / maui update, since our team is currently stuck on standard Xamarin Forms for some time and it solves our need. Maybe we can multi-target both monoandroid12.0 and android-net6.0 to continue support for old Xamarin?
@angularsen
Copy link
Contributor

Not to rain on this project, but it seems to not be actively maintained.

For others running into this, there is an alternative library that is maintained by the Xamarin team, supports both Xamarin Forms and MAUI and seems fairly regularly updated. It worked well for our Xamarin Forms project and we will use that instead.

https://github.com/mono/SkiaSharp.Extended (must use prerelease nugets as of now)

This article was helpful although it explains for MAUI:
https://cedricgabrang.medium.com/implementing-lottie-animations-in-your-net-maui-application-62bd484af651

@Larhei
Copy link

Larhei commented Jan 11, 2024

@martijn00

any chance to get an update?

@Larhei
Copy link

Larhei commented Jan 23, 2024

@martijn00
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants