react-native-bootsplash: Crash: Attempt to invoke direct method 'void android.view.SurfaceControl.checkNotReleased()'

Bug summary

This crash occurs when a Pixel user backgrounds the application before the splashscreen finishes & the hide method can be invoked.

Initially I filed a crash report w/ Google but their response suggests this can be avoided on v12 by perhaps trying to unregister setOnExitAnimationListener, as well as stop any other Splash screen animation/logic - possibly when the activity onPause is invoked?

Crash report: https://issuetracker.google.com/issues/242118185?pli=1

This is likely occurring near this line https://github.com/zoontek/react-native-bootsplash/blob/master/android/src/main/java/com/zoontek/rnbootsplash/RNBootSplashModule.java#L124

Library version

4.3.1

Environment info

SDKs:
    iOS SDK:
      Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5
    Android SDK:
      API Levels: 28, 29, 30, 31, 32
      Build Tools: 29.0.2, 29.0.3, 30.0.2, 30.0.3, 31.0.0, 33.0.0
      System Images: android-30 | Google APIs Intel x86 Atom, android-30 | Google Play Intel x86 Atom
      Android NDK: Not Found
  IDEs:
    Android Studio: 2021.1 AI-211.7628.21.2111.8309675
    Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.15 - /usr/bin/javac

Steps to reproduce

  1. Open an app with react-native-bootscreen
  2. Before the bootscreen completes, background the app
  3. Open the app back up and notice a crash

Reproducible sample code

Should be reproducible in sample app on a Google Pixel device.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 29
  • Comments: 22 (4 by maintainers)

Most upvoted comments

I investigated a bit, and can reproduce it.

The issue is kinda hard to solve since even if I implement a LifecycleEventListener, call activity.getSplashScreen().clearOnExitAnimationListener() on activity pause, it’s already too late:

https://github.com/zoontek/react-native-bootsplash/assets/1902323/ec827aa6-84de-4541-8251-d091bb5ed202

The effect is what appears to be a restart of the UI, but it has no impact on the app itself.

same +1

Android 13 users facing this issue.

Screenshot 2023-04-28 at 12 42 02 PM

Facing the same issue in the 5.0 version also

Could you please just upvote with emojis on the initial message instead of spamming?

No need to trigger notifications for everyone watching this thread just to say “Same”.

We started seeing this crash as well after migrating from react-native-splash-screen to react-native-bootsplash:

Screenshot 2023-06-01 at 1 40 29 PM

We’re facing the same issue on Android 13.

Same image

I just removed this

setOnExitAnimationListener call entirely because I don’t need fade out animation. Then, it seems to be fixed now.

Same

same +1