init

fun init(context: Context, defaultRenderer: RendererType = RendererType.Rive)

Initializes Rive.

This loads the C++ libraries required to use Rive objects and then makes sure to initialize the C++ environment.

If you're still running into native loading issues (for example with split APKs / dynamic feature delivery), you can load native libs yourself and then call initializeCppEnvironment.

System.loadLibrary("c++_shared")
System.loadLibrary("rive-android")
// or if you're using split APKs / dynamic feature delivery:
SplitInstallHelper.loadLibrary(context, "c++_shared")
SplitInstallHelper.loadLibrary(context, "rive-android")
Rive.initializeCppEnvironment()

For split APK / on-demand feature delivery, native libraries can live outside the base APK. In those setups, call SplitInstallHelper.loadLibrary(...) from the split context before calling initializeCppEnvironment. More details: https://developer.android.com/guide/playcore/feature-delivery/on-demand#native-code

Parameters

defaultRenderer

The default renderer to use when initializing File or RiveAnimationView. Defaults to RendererType.Rive.

Throws

if native libraries cannot be loaded.