rive-app / rive-app/rive-android

State machine either crashes or doesn't start

Open
#165 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Kotlin
Stars
538
Forks
66
PR merge metrics
No merged PRs in 30d

Description

Description

Hello there!
I've been playing with state machines on android and found something that seems not right.

The problem is that when I try to launch it, the only thing I can see is this exception

UPD: apparently the problem is that I use blend state without input just to combine multiple micro-animations. The web player is ok with that, but looks like android implementation is not. Can we unify that somehow?

java.lang.RuntimeException: Unable to start activity ComponentInfo{app.rive.runtime.example/app.rive.runtime.example.SimpleStateMachineActivity}: app.rive.runtime.kotlin.core.errors.StateMachineException: No StateMachine found with name main_machine.
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3639)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3796)
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2214)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loopOnce(Looper.java:201)
        at android.os.Looper.loop(Looper.java:288)
        at android.app.ActivityThread.main(ActivityThread.java:7842)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
     Caused by: app.rive.runtime.kotlin.core.errors.StateMachineException: No StateMachine found with name main_machine.
        at app.rive.runtime.kotlin.core.Artboard.stateMachine(Artboard.kt:141)
        at app.rive.runtime.kotlin.RiveDrawable._getOrCreateStateMachines(RiveDrawable.kt:339)
        at app.rive.runtime.kotlin.RiveDrawable._playAnimation(RiveDrawable.kt:355)
        at app.rive.runtime.kotlin.RiveDrawable.play(RiveDrawable.kt:194)
        at app.rive.runtime.kotlin.RiveAnimationView.play(RiveAnimationView.kt:301)
        at app.rive.runtime.kotlin.RiveAnimationView.play$default(RiveAnimationView.kt:296)
        at app.rive.runtime.example.SimpleStateMachineActivity.onCreate(SimpleStateMachineActivity.kt:58)
        at android.app.Activity.performCreate(Activity.java:8051)
        at android.app.Activity.performCreate(Activity.java:8031)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1329)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3612)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3796) 
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103) 
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) 
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2214) 
        at android.os.Handler.dispatchMessage(Handler.java:106) 
        at android.os.Looper.loopOnce(Looper.java:201) 
        at android.os.Looper.loop(Looper.java:288) 
        at android.app.ActivityThread.main(ActivityThread.java:7842) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003) 

However, If i remove input, it just doesn't start

Provide a Repro

Just changed the file to the one I've attached in your SimpleStateMachineActivity sample, changed the state machine name to "main_machine" and added a call for boolean input which should launch the animationanimationView.setBooleanState("main_machine", "Dummy", true).

Source .riv/.rev file

repro.riv.zip

Expected behavior

Launched state machine. On the side note, I wonder, is it possible to make it automatically launched without using inputs?

Device & Versions (please complete the following information)
  • Device: Android emulators
  • SDK Level: 30, 31
Additional context

I'm using this repository with samples, I've updated the repository and the cpp submodule tp the latest version (maybe this is the problem), not sure. The built-in example works as expected though.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the attached repro.riv.zip and app/src/main/java/app/rive/runtime/example/SimpleStateMachineActivity.kt, then trace the stack entries in Artboard.kt, RiveDrawable.kt, and RiveAnimationView.kt. Reproduce both the missing-input crash and the no-input behavior on the stated Android SDK levels; done means the state machine launches consistently and the automatic-launch behavior is addressed or clearly defined.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.