The Rive runtime for Android.
This library is distributed through Maven.
- ⭐️ Rive Overview
- 🚀 Getting Started & API docs
- 🔍 Supported Versions
- 📚 Examples
- 👨💻 Contributing
- ❓ Filing Issues
- 🧰 Troubleshooting
Rive is a real-time, collaborative design and animation tool that helps teams create and run interactive, animated graphics anywhere. Designers and developers work together in the editor to create a Rive file that responds to different states and user inputs. Our lightweight open-source runtime libraries allow them to load this file into apps, games, and websites.
📘 Rive Docs | 🛠 Rive Community
To get started with Rive Android, check the Android section of the runtime docs.
For more information, see the Runtime sections, such as:
Currently, this runtime library supports a minimum SDK version of 21, and the target SDK version is 35.
The build system begins with Gradle, but also includes CMake and Premake at lower levels.
To build the Rive Android library from the Gradle CLI, use the following:
./gradlew :kotlin:assembleRelease
This will produce kotlin/build/outputs/aar/kotlin-release.aar
, which is equivalent to the Android Archive (AAR) file published on Maven.
For advanced use cases, you may want to consider building from source for variants that we do not publish.
You may want to produce an AAR with only particular application binary interfaces (ABIs) included. By default we produce for all four common variants: armeabi-v7a
, arm64-v8a
, x86
, and x86_64
. To choose one, use the following:
./gradlew :kotlin:assembleRelease -PabiFilters=arm64-v8a
You can also build for multiple with a comma separated list:
./gradlew :kotlin:assembleRelease -PabiFilters="arm64-v8a,armeabi-v7a"
Rive Android includes an audio engine by default by linking miniaudio. This allows for playback of audio assets from Rive files. If you do not need this functionality and your goal is to minimize binary size, you can exclude it and save 600kb with the following:
./gradlew :kotlin:assembleRelease -PnoAudio
Check out the app/
folder to see an example application using the Rive Android runtime.
To run the example app set the app
build variant to preview
. In Android Studio, to select which build variant to build and run, go to Build > Select Build Variant and select a build variant from the menu.
The preview
build variant makes use of the hosted Rive dependency. If you're looking to contribute, set the build variant to debug
and see CONTRIBUTING.md
for more information. Building this variant will require additional configuration and setup.
The example showcases a number of ways to manipulate Rive files, including:
- How to include Rive files in a project and reference them
- Setting layout and loop mode options
- Displaying single or multiple artboards in one component
- Setting up and manipulating a state machine via inputs
- Handling events
- Using a low-level API to build a render loop for more control over scenes
- ... and more!
For even more examples and resources on using Rive at runtime or in other tools, checkout the Awesome Rive repo or check out our community.
We love contributions! Check out our contributing docs to get more details into how to run this project locally.
Have an issue with using the runtime, or want to suggest a feature or API to help make your development life better? Log an issue in our issues tab! You can also browse older issues and discussion threads there to see solutions that may have worked for common problems.
Rive Android uses CMake to build the library. You might run into the following error when Rive Android is used alongside other native libraries:
Execution failed for task ':app:mergeDebugNativeLibs'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.MergeNativeLibsTask$MergeNativeLibsTaskWorkAction
> 2 files found with path 'lib/arm64-v8a/libc++_shared.so' from inputs:
…
This is due to both dependencies attempting to include their version of the C++ standard library. You can fix this by prioritizing one by adding this in your build.gradle
:
android {
…
packagingOptions {
pickFirst "lib/x86/libc++_shared.so"
pickFirst "lib/x86_64/libc++_shared.so"
pickFirst "lib/armeabi-v7a/libc++_shared.so"
pickFirst "lib/arm64-v8a/libc++_shared.so"
}
…
}