An Android runtime library for Rive.
The library is distributed through the Maven repository.
- โญ๏ธ Rive Overview
- ๐ Getting Started & API docs
- ๐ Supported Versions
- ๐งช Experimental Features
- ๐ Examples
- ๐จโ๐ป Contributing
- โ Issues
Rive is a real-time interactive design and animation tool that helps teams create and run interactive animations anywhere. Designers and developers use our collaborative editor to create motion graphics that respond to different states and user inputs. Our lightweight open-source runtime libraries allow them to load their animations into apps, games, and websites.
๐ก Homepage
๐ General help docs
๐ Learning Rive
Follow along with the link below for a quick start in getting Rive Android integrated into your multi-platform applications.
Getting Started with Rive in Android
Currently, this runtime library supports a minimum SDK version of 21, and the target SDK version is 33.
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 Rives, including:
- How to include Rive files into the project and reference them
- Setting layout and loop mode options
- Displaying single or multiple animations / artboards on one component
- Setting up and manipulating a state machine via inputs
- Handling events
- Utilizing 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.
The Rive renderer is available experimentally in 7.0.0
.
Read more about the Rive Renderer here. Additional information on choosing a renderer for Rive's runtimes.
You may encounter incompatibilities with specific devices - for example, the new renderer won't work on emulators just yet but only on physical devices.
Your feedback is greatly appreciated during this stage and we'd love to hear from you!
To use the new Rive renderer you can specify the parameter in XML:
<app.rive.runtime.kotlin.RiveAnimationView
app:riveRenderer="Rive"
โฆ />
Alternatively, specify the renderer when initializing Rive:
Rive.init(applicationContext, defaultRenderer = RendererType.Rive)
This default value can still be overriden via XML.
We love contributions! Check out our contributing docs to get more details into how to run this project, the examples, and more all locally.
Have an issue with using the runtime, or want to suggest a feature/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.
After rive-android:6.0.0
, CMake is building the library, and 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:
โฆ
You can fix this 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"
}
โฆ
}
- State Machine Inputs aren't processed on the UI thread anymore, but they are queued and processed
by the worker thread on the
advance()
followingRiveAnimationView.[fireState()/setNumberState()/setBooleanState()]
RiveArtboardRenderer
- Constructor is simplified and now takes fewer parameters
- Deprecated APIs from
RiveArtboardRenderer
are now accessible viaRiveAnimationView
orRiveAnimationView.controller
RiveFileController.hasPlayingAnimations
is nowisAdvancing