Shopify / react-native-skia

High-performance React Native Graphics using Skia
https://shopify.github.io/react-native-skia
MIT License
6.9k stars 446 forks source link

Android Release Builds Fail (RN 0.74+) #2430

Closed enchorb closed 4 months ago

enchorb commented 5 months ago

Description

iOS is fine and Android debug builds are fine. Android release builds fail. (React Native 0.74.1)

Get the error [TypeError: undefined is not a function]

Commenting out the Canvas and all elements within it makes it not crash.

This was working fine on React Native 0.73.8 and Skia 0.1.229

Example provided below but I was also able to replicate with a single Canvas element on a screen also

Version

1.2.3

Steps to reproduce

Build release version of Android app

Snack, code example, screenshot, or link to a repository

enchorb commented 5 months ago

More info: Is working fine on Android versions 11 (API 30) and below

Additional stack:

2024-05-17 22:24:40.995 24513-24622 ReactNativeJS           pid-24513                            E  [TypeError: undefined is not a function]
2024-05-17 22:24:40.996 24513-24623 unknown:ReactNative     pid-24513                            E  TypeError: undefined is not a function, js engine: hermes, stack:
                                                                                                    clearContainer@1:2869768
                                                                                                    Eg@1:2835736
                                                                                                    Th@1:2850621
                                                                                                    Nh@1:2850245
                                                                                                    Ch@1:2847149
                                                                                                    Xc@1:2806156
                                                                                                    J@1:2867011
                                                                                                    R@1:2867353
                                                                                                    anonymous@1:284808
                                                                                                    _callTimer@1:283759
                                                                                                    _callReactNativeMicrotasksPass@1:283903
                                                                                                    callReactNativeMicrotasks@1:285898
                                                                                                    __callReactNativeMicrotasks@1:147100
                                                                                                    anonymous@1:146184
                                                                                                    __guard@1:146938
                                                                                                    flushedQueue@1:146095
                                                                                                    callFunctionReturnFlushedQueue@1:145951
enchorb commented 5 months ago

Upon even more testing and downgrading to React Native 0.73.8 (while keeping Skia at 1.2.3) the Android release builds work again. Seems to be some issue with 0.74+

enchorb commented 5 months ago

@wcandillon any updates here? seems to be an issue with the react-reconciler and Skia in React Native 0.74+ in Android release builds API 31 and above

wcandillon commented 4 months ago

do you have a reproducible example? A project you could share on Github?

enchorb commented 4 months ago

Issue found, seems to be coming from react-native-skottie

idrakimuhamad commented 4 months ago

@enchorb did you file issue to RN-skottie? I faced this issue today and been pulling my hair as the stack only shows [TypeError: undefined is not a function], and no where pointing at skottie. Not until i found your issue, and replacing all my skottie back with rn-lottie and the issue's fix.

jeongshin commented 2 months ago

I'm facing the same issue.🥲

Screenshot 2024-08-09 at 2 45 07 AM
"react-native": "0.74.5",
"@shopify/react-native-skia": "1.3.9",
"react-native-skottie": "2.1.4",
"react-native-reanimated": "3.12.1",
AdamGerthel commented 5 hours ago

I have the same issue, but I'm not convinced that Skottie is the issue, because in my case, Skottie components/animations work fine, it's when I render a Skia canvas in a completely different component that it crashes. Much like the original report, it only happens in release builds and only on Android.

The relevant section from adb logcat

10-21 23:06:36.276 4830 6858 W ReactNativeJS: Error: null 10-21 23:24:05.820 7583 7583 I ReactNative: [GESTURE HANDLER] Initialize gesture handler for root view com.facebook.react.ReactRootView{ccfa845 V.E...... ......ID 0,0-1440,2976 #b} 10-21 23:24:12.709 7583 7925 E ReactNativeJS: TypeError: undefined is not a function

I'm running:

"expo": "^51.0.38",
// ...
"react-native": "0.74.5",
// ...
"react-native-reanimated": "~3.15.5",
// ...
"react-native-skia": "^0.0.1",
"react-native-skottie": "^2.1.4",

The Skia canvas that I'm rendering uses Group (with clippingPath), Image, RoundedRect and LinearGradient.

Update: Nevermind, I removed Skottie and the error disappeared.