The Lottie Android Kotlin Demo is a minimal Android application that shows exactly how to bring stunning, resolution-independent animations to life inside a Kotlin project. Lottie is an open-source library by Airbnb that parses Adobe After Effects animations exported as JSON — via the Bodymovin plugin — and renders them natively on Android (and other platforms) at runtime, with no additional rendering work required from you. This demo app cuts straight to the essentials. It loads two Lottie JSON files (Documentation Index
Fetch the complete documentation index at: https://mintlify.com/tutosrive/lottie-kt-test/llms.txt
Use this file to discover all available pages before exploring further.
wh.json and logo2.json) from the app’s assets folder, displays them inside a LottieAnimationView declared in XML, and lets the user toggle between the two with a single Change button tap. It also demonstrates how to intercept embedded image references in an animation using ImageAssetDelegate, giving you full runtime control over which bitmaps Lottie uses when rendering image layers.
Quickstart
Clone the repo, open it in Android Studio, and see a live Lottie animation running in under five minutes.
Project Setup
Learn how to configure Gradle, add the Lottie dependency, and structure your assets folder.
Loading Animations
Explore how to load, play, loop, and speed-control Lottie JSON files from Kotlin code.
LottieAnimationView Reference
Full reference for every XML attribute and Kotlin API exposed by
LottieAnimationView.What You’ll Learn
Working through this demo and its companion guides takes you from zero to a fully animated Android screen. Each step builds on the previous one so you understand not just what to do, but why each piece is necessary.Add the Lottie Dependency
Add a single line to your module-level
build.gradle.kts to pull the Airbnb Lottie library into your project via Maven Central:Declare LottieAnimationView in XML
Drop
com.airbnb.lottie.LottieAnimationView into your layout file and configure looping, auto-play, and repeat mode entirely through XML attributes — no extra Kotlin needed for basic playback.Load and Play Animations in Kotlin
In
MainActivity.kt, call setAnimation("wh.json") to point Lottie at an asset file, then call playAnimation() to start playback. Adjust speed to control how fast the animation runs.Switch Animations at Runtime
Wire a
Button click listener to swap the active animation file, reset frame to 0, and call playAnimation() again — giving users an interactive toggle between two completely different animations without recreating any views.Key Features
The demo is intentionally small, but it covers the features you’ll reach for most often when integrating Lottie into a real production app.Lottie JSON Rendering
Render After Effects animations exported as
.json files directly from the assets folder with zero extra configuration.Runtime Animation Switching
Swap between any number of animation files on the fly — no Activity restart or view re-inflation required.
XML Attribute Control
Configure
lottie_autoPlay, lottie_loop, and lottie_repeatMode declaratively in your layout XML for clean separation of concerns.ImageAssetDelegate Support
Override bitmap assets embedded in an animation at runtime, enabling dynamic theming, personalisation, or A/B testing of visual content.
Edge-to-Edge UI
Uses
enableEdgeToEdge() and WindowInsetsCompat to render content behind system bars for a modern, full-bleed Android experience.Kotlin-First
Every line of app logic is written in idiomatic Kotlin — no Java interop boilerplate, no legacy View binding patterns.
This project is a learning demo and is not intended for production use as-is. It targets Android API 24+ (
minSdk = 24) and uses Lottie version 6.7.1. Make sure your development environment meets these requirements before running the project.