Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash on API 23 and 24: No non-static method app/rive/runtime/kotlin/RiveArtboardRenderer;.disposeDependencies() #268

Closed
PhilippNowak96 opened this issue Sep 28, 2022 · 3 comments

Comments

@PhilippNowak96
Copy link

Description

I am using Rive with Compose inside of an AndroidView. As soon as you hide the RiveAnimationView (e.g. closing a dialog which contained a rive animation or using AnimatedVisibility), the app crashes on Android API 23 and API 24.
API >= 29 is working fine. Others in between might be affected too, I couldn't test it yet.

Rive Android version: 4.1.0

Provide a Repro

class MainActivity : ComponentActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContent {
            var visible by remember { mutableStateOf(true) }
            RiveAndroidCrashTheme {
                AnimatedVisibility(visible = visible) {
                    AndroidView(
                        modifier = Modifier.fillMaxSize(),
                        factory = { context ->
                            RiveAnimationView(context).also {
                                it.setRiveResource(resId = R.raw.happydoodle)
                            }
                        }
                    )
                }
                Button(onClick = { visible = !visible }) {
                    Text(text = "Toggle Rive View visibility")
                }
            }
        }
    }
}

Source .riv/.rev file

You can take any .riv file from the community place, e.g. https://rive.app/community/2725-5597-happy-doodle/

Expected behavior

No crash

Stacktrace

A/art: art/runtime/java_vm_ext.cc:410] JNI DETECTED ERROR IN APPLICATION: JNI CallVoidMethodV called with pending exception java.lang.NoSuchMethodError: no non-static method "Lapp/rive/runtime/kotlin/RiveArtboardRenderer;.disposeDependencies()V"
A/art: art/runtime/java_vm_ext.cc:410] (Throwable with empty stack trace)
A/art: art/runtime/java_vm_ext.cc:410]     in call to CallVoidMethodV
A/art: art/runtime/java_vm_ext.cc:410] "Thread-1099" prio=9 tid=94 Runnable
A/art: art/runtime/java_vm_ext.cc:410]   | group="main" sCount=0 dsCount=0 obj=0x1389a280 self=0x6fe8592c00
A/art: art/runtime/java_vm_ext.cc:410]   | sysTid=7040 nice=-6 cgrp=default sched=0/0 handle=0x6fe55bf440
A/art: art/runtime/java_vm_ext.cc:410]   | state=R schedstat=( 1043932995 36136589 5823 ) utm=22 stm=82 core=1 HZ=100
A/art: art/runtime/java_vm_ext.cc:410]   | stack=0x6fe54c3000-0x6fe54c5000 stackSize=1013KB
A/art: art/runtime/java_vm_ext.cc:410]   | held mutexes= "mutator lock"(shared held)
A/art: art/runtime/java_vm_ext.cc:410]   native: #00 pc 000000000048cc48  /system/lib64/libart.so (art::DumpNativeStack(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, int, char const*, art::ArtMethod*, void*)+236)
A/art: art/runtime/java_vm_ext.cc:410]   native: #01 pc 000000000045c268  /system/lib64/libart.so (art::Thread::Dump(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const+220)
A/art: art/runtime/java_vm_ext.cc:410]   native: #02 pc 0000000000310680  /system/lib64/libart.so (art::JavaVMExt::JniAbort(char const*, char const*)+1000)
A/art: art/runtime/java_vm_ext.cc:410]   native: #03 pc 0000000000310f38  /system/lib64/libart.so (art::JavaVMExt::JniAbortV(char const*, char const*, std::__va_list)+116)
A/art: art/runtime/java_vm_ext.cc:410]   native: #04 pc 0000000000143f1c  /system/lib64/libart.so (art::ScopedCheck::AbortF(char const*, ...)+144)
A/art: art/runtime/java_vm_ext.cc:410]   native: #05 pc 000000000014adcc  /system/lib64/libart.so (art::ScopedCheck::Check(art::ScopedObjectAccess&, bool, char const*, art::JniValueType*) (.constprop.116)+6088)
A/art: art/runtime/java_vm_ext.cc:410]   native: #06 pc 000000000015d9d0  /system/lib64/libart.so (art::CheckJNI::CallMethodV(char const*, _JNIEnv*, _jobject*, _jclass*, _jmethodID*, std::__va_list, art::Primitive::Type, art::InvokeType)+684)
A/art: art/runtime/java_vm_ext.cc:410]   native: #07 pc 000000000015fc98  /system/lib64/libart.so (art::CheckJNI::CallVoidMethodV(_JNIEnv*, _jobject*, _jmethodID*, std::__va_list)+68)
A/art: art/runtime/java_vm_ext.cc:410]   native: #08 pc 00000000000670c4  /data/app/de.pixelhouse-1/lib/arm64/libjnirivebridge.so (???)
A/art: art/runtime/java_vm_ext.cc:410]   native: #09 pc 000000000006705c  /data/app/de.pixelhouse-1/lib/arm64/libjnirivebridge.so (???)
A/art: art/runtime/java_vm_ext.cc:410]   native: #10 pc 0000000000068c2c  /data/app/de.pixelhouse-1/lib/arm64/libjnirivebridge.so (???)
A/art: art/runtime/java_vm_ext.cc:410]   native: #11 pc 000000000006b6d4  /data/app/de.pixelhouse-1/lib/arm64/libjnirivebridge.so (???)
A/art: art/runtime/java_vm_ext.cc:410]   native: #12 pc 0000000000066ca4  /system/lib64/libc.so (__pthread_start(void*)+52)
A/art: art/runtime/java_vm_ext.cc:410]   native: #13 pc 000000000001eb84  /system/lib64/libc.so (__start_thread+16)
A/art: art/runtime/java_vm_ext.cc:410]   (no managed stack frames)

Device & Versions (please complete the following information)

  • Device: Android Emulator
  • SDK Level: at least API 23 and API 24
  • Rive Android version used: 4.1.0

Additional context

Version 1.0.3 did not have the problem (yeah, kinda old, but I just updated recently).

@PhilippNowak96
Copy link
Author

This morning I tried to find out which version causes the issue. It's 4.0.0 which introduced the crash. 3.1.2 is working fine.

mjtalbot pushed a commit that referenced this issue Oct 5, 2022
Fix visibility for JNI on API < 24 as reported here - #268

Diffs=
5fd803a66 Visibility modifier on API < 24
@umberto-sonnino
Copy link
Contributor

Thanks for the report, we deployed a fix for this with 4.2.0

@PhilippNowak96
Copy link
Author

Works like charm, thank your for the fix 😊

rive-engineering pushed a commit that referenced this issue Dec 5, 2024
This pull request addresses the following GitHub issues and more:
- [rive-ios #345](rive-app/rive-ios#345)
- [rive-react-native #268](rive-app/rive-react-native#268)

Thanks to some help from @luigi-rosso, we discovered that the iOS runtime build scripts were _not_ including the Yoga renames, causing a collision when some frameworks were statically linked in React Native environments.

This has been tested locally, and works, but the real test will be the public.

Diffs=
437688c18e Add yoga renames to non-v2 lua build scripts (#8693)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants