rive-android

Introduction: A runtime for interactive animations on Android
More: Author   ReportBugs   OfficialWebsite   
Tags:

Build Status Test Status Discord badge Twitter handle

Rive hero image

An Android runtime library for Rive.

The library is distributed through the Maven repository.

Table of contents

Rive overview

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

📘 Rive docs

🛠 Rive Forums

Getting started

To get started with Rive Android, check out the following resources:

For more information, see the Runtime sections of the Rive help documentation:

Supported versions

Currently, this runtime library supports a minimum SDK version of 21, and the target SDK version is 34.

Examples

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!

Awesome Rive

For even more examples and resources on using Rive at runtime or in other tools, checkout the awesome-rive repo.

Experimental features

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.

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.

Contributing

We love contributions! Check out our contributing docs to get more details into how to run this project, the examples, and more all locally.

Issues

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.

Known issues

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"
  }
  …
}

Breaking changes

9.0.0

  • State Machine Inputs aren't processed on the UI thread anymore, but they are queued and processed by the worker thread on the advance() following RiveAnimationView.[fireState()/setNumberState()/setBooleanState()]
  • RiveArtboardRenderer
    • Constructor is simplified and now takes fewer parameters
    • Deprecated APIs from RiveArtboardRenderer are now accessible via RiveAnimationView or RiveAnimationView.controller
  • RiveFileController.hasPlayingAnimations is now isAdvancing
Apps
About Me
GitHub: Trinea
Facebook: Dev Tools