margelo / react-native-skottie

▶️ Efficient lottie animations using Skia's Skottie module
https://margelo.io
MIT License
872 stars 24 forks source link

Skottie causing crashes on Android release build only on Expo SDK 51 #52

Open idrakimuhamad opened 5 months ago

idrakimuhamad commented 5 months ago

We've recently upgrade expo SDK 51 and didn't realise this as it only happened in release build. However, the crash are rather hard to pin-point because the only trace in sentry/crashlytics is [TypeError: undefined is not a function]. It doesn't show at which line and which function, and doesn't point that to skottie at all.

At first I thought it was reanimated issue, then I suspect it to be Skia. Anything that have the Canvas will crash the app instantly. Not until I found this issue..

After replacing all skotie instance with rn-lottie, the issue gone away.

I will try to create a repro tomorrow, if that's needed.

enestatli commented 3 months ago

Hi everyone,

I am also experiencing the same issue with react-native-skottie on Android in release mode. I started a new project with the latest Expo SDK 51, and my app crashes at launch with the error below in logcat, but without any specific trace pointing to skottie.

07-27 13:29:50.483 17945 17974 E ReactNativeJS: TypeError: undefined is not a function, js engine: hermes
07-27 13:29:50.484 17945 17974 E ReactNativeJS: TypeError: Cannot read property 'ErrorBoundary' of undefined
07-27 13:29:50.484 17945 17974 E ReactNativeJS:
07-27 13:29:50.484 17945 17974 E ReactNativeJS: This error is located at:
07-27 13:29:50.484 17945 17974 E ReactNativeJS:     in SceneView
07-27 13:29:50.484 17945 17974 E ReactNativeJS:     in RCTView
07-27 13:29:50.484 17945 17974 E ReactNativeJS:     in Unknown
...

After removing skottie usage, the issue was resolved.

Here are my configurations for reference:

Proguard Rules

# react-native-reanimated
-keep class com.swmansion.reanimated.** { *; }
-keep class com.facebook.react.turbomodule.** { *; }

# react-native-skia
-keep class com.shopify.reactnative.skia.** { *; }

# react-native-skottie
-keep class com.skiaskottie.** { *; }

# hermes
-keep class com.facebook.hermes.unicode.** { *; }
-keep class com.facebook.jni.** { *; }

# react-native-svg
-keep public class com.horcrux.svg.** {*;}

#https://github.com/react-native-device-info/react-native-device-info/issues/1607
-keep class com.android.installreferrer.api.** {
  *;
}

#https://github.com/react-native-device-info/react-native-device-info#proguard
-keep class com.google.android.gms.common.** {*;}

# expo.modules.kotlin.views.GroupViewManagerWrapper.createViewInstance
# Fatal Exception: java.lang.ClassCastException: android.view.View cannot be cast to android.view.ViewGroup
# https://github.com/expo/expo/issues/20122#issuecomment-1337041362
-keep class expo.modules.** { *; }

package.json

 "dependencies": {
    ...
    "@shopify/react-native-skia": "^1.2.3",
    "expo": "~51.0.18",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "react-native": "0.74.3",
    "react-native-reanimated": "~3.10.1",
    "react-native-skottie": "^2.1.4",
    ...
  }
davidwinograd1 commented 3 months ago

any solution?

AdamGerthel commented 3 weeks ago

Same issue for me, see https://github.com/Shopify/react-native-skia/issues/2430#issuecomment-2427764570

Will be moving to lottie-react-native as this breaking production right now. Let me know if you want any other types of logs or tests.