Crash: Canvas: trying to draw too large

From my basic research of the issue,I believe this is caused by the size of Splash screen image being too big. But in my case it is 1284x2778 (as recommended in expo docs), same as it was before migrating to eas.

app.json

"expo": {
    ...
    "splash": {
      "image": "./assets/splash.png",
      "resizeMode": "contain",
      "backgroundColor": "#ffff"
    },

eas.json

"builds": {
    "android": {
      "release": {
        "workflow": "managed",
        "releaseChannel": "prod-android-8"
      }
    }

Following error is seen on some of the samsung devices.

05-30 16:56:37.071 29164 29164 E AndroidRuntime: FATAL EXCEPTION: main
05-30 16:56:37.071 29164 29164 E AndroidRuntime: Process: com.edukuu.edukuuapp, PID: 29164
05-30 16:56:37.071 29164 29164 E AndroidRuntime: java.lang.RuntimeException: Canvas: trying to draw too large(228284928bytes) bitmap.
05-30 16:56:37.071 29164 29164 E AndroidRuntime: 	at android.view.DisplayListCanvas.throwIfCannotDraw(DisplayListCanvas.java:260)
05-30 16:56:37.071 29164 29164 E AndroidRuntime: 	at android.graphics.Canvas.drawBitmap(Canvas.java:1420)
05-30 16:56:37.071 29164 29164 E AndroidRuntime: 	at android.graphics.drawable.BitmapDrawable.draw(BitmapDrawable.java:545)
05-30 16:56:37.071 29164 29164 E AndroidRuntime: 	at android.widget.ImageView.onDraw(ImageView.java:1286)
05-30 16:56:37.071 29164 29164 E AndroidRuntime: 	at android.view.View.draw(View.java:18318)
05-30 16:56:37.071 29164 29164 E AndroidRuntime: 	at android.view.View.updateDisplayListIfDirty(View.java:17296)
05-30 16:56:37.071 29164 29164 E AndroidRuntime: 	at android.view.View.draw(View.java:18080)
05-30 16:56:37.071 29164 29164 E AndroidRuntime: 	at android.view.ViewGroup.drawChild(ViewGroup.java:3966)
05-30 16:56:37.071 29164 29164 E AndroidRuntime: 	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3752)
05-30 16:56:37.071 29164 29164 E AndroidRuntime: 	at android.view.View.draw(View.java:18321)
05-30 16:56:37.071 29164 29164 E AndroidRuntime: 	at android.view.View.updateDisplayListIfDirty(View.java:17296)
05-30 16:56:37.071 29164 29164 E AndroidRuntime: 	at android.view.View.draw(View.java:18080)
05-30 16:56:37.071 29164 29164 E AndroidRuntime: 	at android.view.ViewGroup.drawChild(ViewGroup.java:3966)
05-30 16:56:37.071 29164 29164 E AndroidRuntime: 	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3752)
05-30 16:56:37.071 29164 29164 E AndroidRuntime: 	at android.view.View.updateDisplayListIfDirty(View.java:17291)
05-30 16:56:37.071 29164 29164 E AndroidRuntime: 	at android.view.View.draw(View.java:18080)
05-30 16:56:37.071 29164 29164 E AndroidRuntime: 	at android.view.ViewGroup.drawChild(ViewGroup.java:3966)
05-30 16:56:37.071 29164 29164 E AndroidRuntime: 	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3752)
05-30 16:56:37.071 29164 29164 E AndroidRuntime: 	at android.view.View.updateDisplayListIfDirty(View.java:17291)
05-30 16:56:37.071 29164 29164 E AndroidRuntime: 	at android.view.View.draw(View.java:18080)
05-30 16:56:37.071 29164 29164 E AndroidRuntime: 	at android.view.ViewGroup.drawChild(ViewGroup.java:3966)
05-30 16:56:37.071 29164 29164 E AndroidRuntime: 	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3752)
05-30 16:56:37.071 29164 29164 E AndroidRuntime: 	at android.view.View.updateDisplayListIfDirty(View.java:17291)
05-30 16:56:37.071 29164 29164 E AndroidRuntime: 	at android.view.View.draw(View.java:18080)
05-30 16:56:37.071 29164 29164 E AndroidRuntime: 	at android.view.ViewGroup.drawChild(ViewGroup.java:3966)
05-30 16:56:37.071 29164 29164 E AndroidRuntime: 	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3752)
05-30 16:56:37.071 29164 29164 E AndroidRuntime: 	at android.view.View.updateDisplayListIfDirty(View.java:17291)
05-30 16:56:37.071 29164 29164 E AndroidRuntime: 	at android.view.View.draw(View.java:18080)
05-30 16:56:37.071 29164 29164 E AndroidRuntime: 	at android.view.ViewGroup.drawChild(ViewGroup.java:3966)
05-30 16:56:37.071 29164 29164 E AndroidRuntime: 	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3752)
05-30 16:56:37.071 29164 29164 E AndroidRuntime: 	at android.view.View.draw(View.java:18321)
05-30 16:56:37.071 29164 29164 E AndroidRuntime: 	at com.android.internal.policy.DecorView.draw(DecorView.java:919)
05-30 16:56:37.071 29164 29164 E AndroidRuntime: 	at android.view.View.updateDisplayListIfDirty(View.java:17296)
05-30 16:56:37.071 29164 29164 E AndroidRuntime: 	at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:692)
05-30 16:56:37.071 29164 29164 E AndroidRuntime: 	at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:698)
05-30 16:56:37.071 29164 29164 E AndroidRuntime: 	at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:806)
05-30 16:56:37.071 29164 29164 E AndroidRuntime: 	at android.view.ViewRootImpl.draw(ViewRootImpl.java:3128)
05-30 16:56:37.071 29164 29164 E AndroidRuntime: 	at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2924)
05-30 16:56:37.071 29164 29164 E AndroidRuntime: 	at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2516)
05-30 16:56:37.071 29164 29164 E AndroidRuntime: 	at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1515)
05-30 16:56:37.071 29164 29164 E AndroidRuntime: 	at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7091)
05-30 16:56:37.071 29164 29164 E AndroidRuntime: 	at android.view.Choreographer$CallbackRecord.run(Choreographer.java:927)
05-30 16:56:37.071 29164 29164 E AndroidRuntime: 	at android.view.Choreographer.doCallbacks(Choreographer.java:702)
05-30 16:56:37.071 29164 29164 E AndroidRuntime: 	at android.view.Choreographer.doFrame(Choreographer.java:638)
05-30 16:56:37.071 29164 29164 E AndroidRuntime: 	at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:913)
05-30 16:56:37.071 29164 29164 E AndroidRuntime: 	at android.os.Handler.handleCallback(Handler.java:751)
05-30 16:56:37.071 29164 29164 E AndroidRuntime: 	at android.os.Handler.dispatchMessage(Handler.java:95)
05-30 16:56:37.071 29164 29164 E AndroidRuntime: 	at android.os.Looper.loop(Looper.java:154)
05-30 16:56:37.071 29164 29164 E AndroidRuntime: 	at android.app.ActivityThread.main(ActivityThread.java:6682)
05-30 16:56:37.071 29164 29164 E AndroidRuntime: 	at java.lang.reflect.Method.invoke(Native Method)
05-30 16:56:37.071 29164 29164 E AndroidRuntime: 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520)
05-30 16:56:37.071 29164 29164 E AndroidRuntime: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)

I am getting the above error on Android 8 devices.

When I expo run:android, expo-splash-screen package gets automatically added into my dependencies.
Since expo run:android runs expo prebuild, which is also run in eas build i believe this package gets added to my production eas build which makes the android app crash on android 8 devices.

As mentioned here: Recommended size splash screens crash Android app · Issue #4020 · expo/expo · GitHub, it seems like expo-splash-screen package is the culprit, because without it everything was working smoothly with classic build on managed workflow.

the problem is that eas build for managed apps doesn’t support the different dpi configurations for splash screens yet. we’ll fix that soon.

@notbrent Thanks for the reply. May I ask how this gets handled in classic build in managed apps or is there any workaround to prevent the crash?

in classic build we do support different dpi configurations, and otherwise use this xdl/AndroidShellApp.js at aef7bcf691ea539aa61c35aff3f5ef43021ada92 · expo/xdl · GitHub