Com.Nkkinsoft.Android.Lottie
6.7.3
See the version list below for details.
Requires NuGet 2.12 or higher.
dotnet add package Com.Nkkinsoft.Android.Lottie --version 6.7.3
NuGet\Install-Package Com.Nkkinsoft.Android.Lottie -Version 6.7.3
<PackageReference Include="Com.Nkkinsoft.Android.Lottie" Version="6.7.3" />
<PackageVersion Include="Com.Nkkinsoft.Android.Lottie" Version="6.7.3" />
<PackageReference Include="Com.Nkkinsoft.Android.Lottie" />
paket add Com.Nkkinsoft.Android.Lottie --version 6.7.3
#r "nuget: Com.Nkkinsoft.Android.Lottie, 6.7.3"
#:package Com.Nkkinsoft.Android.Lottie@6.7.3
#addin nuget:?package=Com.Nkkinsoft.Android.Lottie&version=6.7.3
#tool nuget:?package=Com.Nkkinsoft.Android.Lottie&version=6.7.3
LottieXamarin
See ENGINEERING-AUDIT.md for the validated Android package build, remaining platform blockers and reproduction commands.
.NET bindings and UI projects for Lottie animations. This is a community fork, not an official Airbnb release. The Android binding bundles lottie-android 6.7.1; the Apple binding uses the native static libraries checked into this repository. Package versions below describe the current project files, not necessarily versions already published to NuGet.
Projects and targets
| Project | Package ID / project version | Declared target frameworks | Status |
|---|---|---|---|
Lottie.Android |
Com.Nkkinsoft.Android.Lottie / 6.7.3 |
net10.0-android, net11.0-android |
Android binding; API 24+ |
Lottie.iOS |
Com.Nkkinsoft.iOS.Lottie / 4.0.0 |
net10.0-ios, net10.0-maccatalyst, net11.0-ios, net11.0-maccatalyst |
Native binding; iOS 13.0+ and Mac Catalyst 13.1+ declared |
Lottie.Maui |
Com.Nkkinsoft.Maui.Lottie / 1.0.0 |
.NET 10/11 for Android, iOS and Mac Catalyst; Windows targets added on Windows hosts | Handler migration in progress; see Current limitations |
Lottie.Forms |
Com.Nkkinsoft.Xamarin.Forms.Lottie / 5.0.0 |
netstandard2.0, net10.0, net11.0; on Windows also net10.0-windows10.0.22621.0, net11.0-windows10.0.22621.0 |
Legacy renderer code remains, but its Android/iOS platform targets are not declared |
Lottie.Maui declares Android API 24+, iOS 13.0+, Mac Catalyst 13.1+ and Windows 10.0.19041.0+. Its Android/iOS projects reference the binding projects from this repository; Windows references LottieSharp. These are project targets, not a claim that every target currently builds or runs. tvOS, watchOS, Tizen and UWP appear in legacy sources or conditional item groups but are not current declared targets of the binding/MAUI projects.
Android binding
Add the package to a .NET for Android app using a version available on your NuGet feed:
<PackageReference Include="Com.Nkkinsoft.Android.Lottie" Version="6.7.3" />
If 6.7.3 has not been published, build or pack this checkout, or select an available package version. The binding references Square.OkIO 3.17.0.1 and Xamarin.AndroidX.AppCompat 1.8.0 as NuGet dependencies. Its minimum supported Android API level is 24.
Place animation.json in your Android app's Assets directory with the AndroidAsset build action. A view in an Android layout can then use the bundled Lottie resource attributes:
<com.airbnb.lottie.LottieAnimationView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/animation_view"
android:layout_width="200dp"
android:layout_height="200dp"
app:lottie_fileName="animation.json"
app:lottie_autoPlay="true"
app:lottie_loop="true" />
For a view created or found in C#, load the same asset programmatically instead of using the XML lottie_fileName/lottie_autoPlay attributes:
using Com.Airbnb.Lottie;
var view = FindViewById<LottieAnimationView>(Resource.Id.animation_view);
view?.SetAnimation("animation.json");
view?.PlayAnimation();
The C# example assumes an Android Activity after SetContentView(Resource.Layout.activity_main); omit the explicit load/play calls if the XML above already loads and autoplays the animation.
Composition loading helpers
LottieComposition.Factory contains callback overloads returning ICancellable and these three task-based wrappers (each accepts an optional CancellationToken):
FromAssetFileNameAsync(Context context, string fileName)FromJsonStringAsync(string jsonString)FromInputStreamAsync(Stream stream)
For example, inside an Android Activity with a LottieAnimationView:
using Com.Airbnb.Lottie;
var composition = await LottieComposition.Factory.FromAssetFileNameAsync(this, "animation.json");
if (composition is not null)
{
animationView.Composition = composition;
animationView.PlayAnimation();
}
Pass the raw JSON text to FromJsonStringAsync, not a URL. A stream supplied to FromInputStreamAsync must contain animation JSON. These helpers cover three load paths, not every upstream factory method. The task wrappers handle completion/cancellation races without throwing from a Java callback, and release their cancellation registration when the task finishes. The Android binding also exposes SetImageAssetDelegate(Func<LottieImageAsset, Android.Graphics.Bitmap?>) for image assets supplied by your app.
Current limitations
- The MAUI
AnimationViewhandlers are still in migration: apps must register the platform handler manually, and this repository does not provide aUseLottiebuilder extension. Playback commands are wired for Android, iOS, Mac Catalyst, and Windows handlers, but only Android and Windows .NET 11 targets have been compiled in this environment; Apple targets need an Apple build host for verification. The checked-in MAUI sample still targets .NET 7 and does not referenceLottie.Maui; do not use it as a verified .NET 10/11 integration example. Treat MAUI platform support as in progress, not a tested drop-in package. Lottie.Formsstill contains Xamarin.Forms renderer sources and conditional platform references, but its current targets do not include Android or iOS. Do not infer working Xamarin.Forms mobile support from those source directories.- The Apple project packages existing
libLottie-ios.a/libLottie-macos.aandLOT*Objective-C bindings. Its project descriptions mention lottie-ios 4.5.x, but the bundled native libraries are not established here as that upstream release. Mac Catalystnet11.0resolvesMicrosoft.macOS.dllfrom the installed .NET targeting pack instead of assuming one machine's pack version. Preview-feature metadata is enabled only for the .NET 11 Apple targets. Lottie.Android/Transforms/Metadata.xmlexcludes several upstream types (including generic value callbacks, some animation internals and network bindings). The managed API is not a complete one-to-one surface of lottie-android. The bundled Android resources includelottie_rawRes; it is not removed.- Project files configure portable PDBs and symbol packages. They do not establish that every release has a published
.snupkg. No trim/AOT safety guarantee or universal ProGuard/R8 rule exemption is verified; test release builds with your app's linker and AOT settings.
Building from source
Install the appropriate .NET 10/11 SDK and workloads for the target platform (dotnet workload install android for Android). Build a specific target rather than the entire solution, which includes older Xamarin.Forms/native samples and the .NET 7 MAUI sample:
dotnet build Lottie.Android/Lottie.Android.csproj -f net11.0-android -c Release -p:GeneratePackageOnBuild=false
dotnet pack Lottie.Android/Lottie.Android.csproj -c Release -o ./artifacts
dotnet pack targets both Android frameworks by default; install the corresponding SDK/workload for both, or specify -f net10.0-android to pack only one target. The Release configuration sets GeneratePackageOnBuild=true in Directory.Build.props; the explicit override in the build command avoids an extra package during compilation. In this checkout, Lottie.Android and the MAUI Android target both compiled for net11.0-android; the MAUI build reported transitive AndroidX version-range warnings (NU1608). iOS and Mac Catalyst builds require the appropriate Apple toolchain/host and native binding dependencies; they were not verified here.
License and links
Licensed under Apache-2.0. Lottie is an Airbnb project; this fork is maintained separately.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0-android36.0 is compatible. net11.0-android37.0 is compatible. |
-
net10.0-android36.0
- Square.OkIO (>= 3.17.0.1)
- Xamarin.AndroidX.AppCompat (>= 1.8.0)
-
net11.0-android37.0
- Square.OkIO (>= 3.17.0.1)
- Xamarin.AndroidX.AppCompat (>= 1.8.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Com.Nkkinsoft.Android.Lottie:
| Package | Downloads |
|---|---|
|
Com.Nkkinsoft.Maui.Lottie
Lottie for .NET MAUI 10 and 11 (community fork): an AnimationView control that renders After Effects animations natively on Android (lottie-android 6.7.1) and iOS (lottie-ios 2.5.x). Register it with builder.UseLottie(). |
GitHub repositories
This package is not used by any popular GitHub repositories.