Getting Started with Lottie Animations in an Android App

This blog was originally published on 5 May 2020. It has since been updated as of 16 January 2026.
Lottie is a lightweight animation format that makes it easy to bring rich, vector animations into your Android app with minimal setup. In this guide, you’ll learn how to add and configure Lottie animations in Android Studio.
1. Choose your Lottie
Start by selecting a Lottie animation for your Android app. You can use your own animation or choose from the thousands of free animations available on LottieFiles.
It’s important to test your selected animation using the LottieFiles app for Android to ensure it renders correctly. While Lottie aims to be consistent across platforms, some animations may use features that aren’t fully supported by the Android runtime.
To preview an animation:
- Install the LottieFiles app for Android
- Open an animation on LottieFiles
- Scan the QR code under the animation to preview it on your device

2. Setup your project
This guide assumes you’re using Android Studio, but the same steps apply if you’re using another IDE.
Open your module’s build.gradle file and add the Lottie dependency:
def lottieVersion = "6.x.x"
implementation "com.airbnb.android:lottie:$lottieVersion"
Replace lottieVersion with the latest available.
Note: If your project uses Jetpack Compose, Lottie provides a dedicated Compose library. See the Jetpack Compose section below.
Add LottieAnimationView to your layout
The lottie-android library includes LottieAnimationView, which handles loading and rendering animations for you.
Add it to your layout XML where you want the animation to appear:
<com.airbnb.lottie.LottieAnimationView
android:id="@+id/animationView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:lottie_url="REPLACE_JSON_URL"
app:lottie_autoPlay="true"
app:lottie_loop="true" />Recommended: Bundling animations with your app
If your app needs to play animations offline, you can bundle them directly with your application.
- Create a raw resources folder if you don’t already have one
(File > New > Android Resource Directory, then select raw) - Download your animation and place it in the res/raw directory
- Use a .json file for animations without external images
- Use a .zip file if the animation includes image assets
<com.airbnb.lottie.LottieAnimationView
android:id="@+id/animationView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:lottie_rawRes="@raw/animation"
app:lottie_autoPlay="true"
app:lottie_loop="true" />
Your first Android project with Lottie animations is ready to go! All that’s left for you to do from here is to configure your project further and customize the animation behaviour.
The official documentation for lottie-android provides further information on these configurations.
5. (Optional) Using Lottie with Jetpack Compose
Jetpack Compose is Android’s modern UI toolkit, and Lottie provides first-class support for Compose alongside the traditional View-based approach.
If your app is built with Compose, you can render Lottie animations directly inside composable functions.
5.1 Add the Compose dependency
In your module’s build.gradle file:
implementation "com.airbnb.android:lottie-compose:6.x.x"
This is a separate artifact from the View-based lottie-android dependency. Once you’ve added the dependency, and assuming you already bundled the animation in your app as described above, you can go ahead and add the animation to your app.
5.2 Basic Lottie animation in Compose
@Composable
fun LottieComposeAnimation() {
val composition by rememberLottieComposition(
LottieCompositionSpec.RawRes(R.raw.animation)
)
val progress by animateLottieCompositionAsState(
composition = composition,
iterations = LottieConstants.IterateForever
)
LottieAnimation(
composition = composition,
progress = { progress }
)
}
In Compose, animation playback is driven by state. You can easily control looping, playback, speed, or pause and resume based on user interaction.
Get more in your Android apps with our most optimized format - dotLottie
To further optimize Android apps, consider using dotLottie files. dotLottie is an evolution of the Lottie format designed to reduce file sizes and simplify asset management.
dotLottie files:
- Use ZIP compression to reduce file size (often up to 80%)
- Can bundle multiple animations, images, and themes in a single file
- Support advanced features like interactive state machines and theming
LottieFiles provides dedicated dotLottie Android libraries and runtimes to render .lottie files efficiently on Android.
To help you get started, check out these blogs:
You may also like

Lottie/dotLottie vs. GIF: Choosing the Right Animation for You
The two most popular web animation formats, Lottie and GIF, collide head-on. This blog will focus on the 5 most important parameters to tell you who's the boss!

Introducing Motion Copilot 2.0 in Lottie Creator
Motion Copilot is no longer just a keyframing helper; it's a full animation assistant.

Lottie Creator 2.0: A Powerful Web-Based Lottie Animation Tool
Reimagine animation creation with Lottie Creator

Introducing Motion System: One Workflow for Animation That Actually Ships
LottieFiles Motion System is the first workspace-level governance layer for motion.
