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

App crashing on Android (com.horcrux.svg.SvgView.onDraw) #1394

Closed
3luyka opened this issue Jun 5, 2020 · 8 comments
Closed

App crashing on Android (com.horcrux.svg.SvgView.onDraw) #1394

3luyka opened this issue Jun 5, 2020 · 8 comments
Labels
Close when stale This issue is going to be closed when there is no activity for a while Missing repro This issue need minimum repro scenario stale

Comments

@3luyka
Copy link

3luyka commented Jun 5, 2020

Hey there!

I've got several crash reports.
This is happens only on Android 10. (Pixel 3 XL / Pixel 2 XL / Pixel 4 XL).

Environment info

System:
    OS: macOS 10.15.5
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 65.89 MB / 16.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 13.8.0 - /usr/local/bin/node
    Yarn: 1.22.0 - /usr/local/bin/yarn
    npm: 6.13.7 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 13.5, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2
    Android SDK:
      API Levels: 28
      Build Tools: 28.0.3, 29.0.2
      System Images: android-27 | Google Play Intel x86 Atom, android-28 | Intel x86 Atom_64, android-28 | Google APIs Intel x86 Atom, android-28 | Google Play Intel x86 Atom, android-29 | Google Play Intel x86 Atom
      Android NDK: Not Found
  IDEs:
    Android Studio: 3.6 AI-192.7142.36.36.6200805
    Xcode: 11.5/11E608c - /usr/bin/xcodebuild
  Languages:
    Python: 2.7.16 - /usr/bin/python
  npmPackages:
    @react-native-community/cli: Not Found
    react: 16.11.0 => 16.11.0 
    react-native: 0.62.2 => 0.62.2 
  npmGlobalPackages:

Library version: 12.1.0

Crash stack info

java.lang.RuntimeException
com.horcrux.svg.SvgView.onDraw

java.lang.RuntimeException: 
  at android.graphics.RecordingCanvas.throwIfCannotDraw (RecordingCanvas.java:280)
  at android.graphics.BaseRecordingCanvas.drawBitmap (BaseRecordingCanvas.java:69)
  at com.horcrux.svg.SvgView.onDraw (SvgView.java:109)
  at android.view.View.draw (View.java:21975)
  at android.view.View.updateDisplayListIfDirty (View.java:20852)
  at android.view.View.draw (View.java:21707)
  at android.view.ViewGroup.drawChild (ViewGroup.java:4432)
  at android.view.ViewGroup.dispatchDraw (ViewGroup.java:4193)
  at com.facebook.react.views.view.ReactViewGroup.dispatchDraw (ReactViewGroup.java:703)
  at android.view.View.updateDisplayListIfDirty (View.java:20843)
  at android.view.View.draw (View.java:21707)
  at android.view.ViewGroup.drawChild (ViewGroup.java:4432)
  at android.view.ViewGroup.dispatchDraw (ViewGroup.java:4193)
  at com.facebook.react.views.view.ReactViewGroup.dispatchDraw (ReactViewGroup.java:703)
  at android.view.View.updateDisplayListIfDirty (View.java:20843)
  at android.view.View.draw (View.java:21707)
  at android.view.ViewGroup.drawChild (ViewGroup.java:4432)
  at android.view.ViewGroup.dispatchDraw (ViewGroup.java:4193)
  at com.facebook.react.views.view.ReactViewGroup.dispatchDraw (ReactViewGroup.java:703)
  at android.view.View.updateDisplayListIfDirty (View.java:20843)
  at android.view.View.draw (View.java:21707)
  at android.view.ViewGroup.drawChild (ViewGroup.java:4432)
  at android.view.ViewGroup.dispatchDraw (ViewGroup.java:4193)
  at com.facebook.react.ReactRootView.dispatchDraw (ReactRootView.java:232)
  at android.view.View.updateDisplayListIfDirty (View.java:20843)
  at android.view.ViewGroup.recreateChildDisplayList (ViewGroup.java:4416)
  at android.view.ViewGroup.dispatchGetDisplayList (ViewGroup.java:4389)
  at android.view.View.updateDisplayListIfDirty (View.java:20812)
  at android.view.ViewGroup.recreateChildDisplayList (ViewGroup.java:4416)
  at android.view.ViewGroup.dispatchGetDisplayList (ViewGroup.java:4389)
  at android.view.View.updateDisplayListIfDirty (View.java:20812)
  at android.view.ViewGroup.recreateChildDisplayList (ViewGroup.java:4416)
  at android.view.ViewGroup.dispatchGetDisplayList (ViewGroup.java:4389)
  at android.view.View.updateDisplayListIfDirty (View.java:20812)
  at android.view.ViewGroup.recreateChildDisplayList (ViewGroup.java:4416)
  at android.view.ViewGroup.dispatchGetDisplayList (ViewGroup.java:4389)
  at android.view.View.updateDisplayListIfDirty (View.java:20812)
  at android.view.ViewGroup.recreateChildDisplayList (ViewGroup.java:4416)
  at android.view.ViewGroup.dispatchGetDisplayList (ViewGroup.java:4389)
  at android.view.View.updateDisplayListIfDirty (View.java:20812)
  at android.view.ViewGroup.recreateChildDisplayList (ViewGroup.java:4416)
  at android.view.ViewGroup.dispatchGetDisplayList (ViewGroup.java:4389)
  at android.view.View.updateDisplayListIfDirty (View.java:20812)
  at android.view.ViewGroup.recreateChildDisplayList (ViewGroup.java:4416)
  at android.view.ViewGroup.dispatchGetDisplayList (ViewGroup.java:4389)
  at android.view.View.updateDisplayListIfDirty (View.java:20812)
  at android.view.ThreadedRenderer.updateViewTreeDisplayList (ThreadedRenderer.java:581)
  at android.view.ThreadedRenderer.updateRootDisplayList (ThreadedRenderer.java:587)
  at android.view.ThreadedRenderer.draw (ThreadedRenderer.java:664)
  at android.view.ViewRootImpl.draw (ViewRootImpl.java:3767)
  at android.view.ViewRootImpl.performDraw (ViewRootImpl.java:3495)
  at android.view.ViewRootImpl.performTraversals (ViewRootImpl.java:2779)
  at android.view.ViewRootImpl.doTraversal (ViewRootImpl.java:1745)
  at android.view.ViewRootImpl$TraversalRunnable.run (ViewRootImpl.java:7768)
  at android.view.Choreographer$CallbackRecord.run (Choreographer.java:967)
  at android.view.Choreographer.doCallbacks (Choreographer.java:791)
  at android.view.Choreographer.doFrame (Choreographer.java:726)
  at android.view.Choreographer$FrameDisplayEventReceiver.run (Choreographer.java:952)
  at android.os.Handler.handleCallback (Handler.java:883)
  at android.os.Handler.dispatchMessage (Handler.java:100)
  at android.os.Looper.loop (Looper.java:214)
  at android.app.ActivityThread.main (ActivityThread.java:7356)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:492)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:930)
@3luyka
Copy link
Author

3luyka commented Jun 5, 2020

Hi @msand, could you please take a look on this?

@3luyka
Copy link
Author

3luyka commented Jun 5, 2020

This happens when I try to set something like:

<Svg style={{ width: deviceWidth * 3, height: deviceHeight * 3  }} ... />

@stale
Copy link

stale bot commented Aug 8, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. You may also mark this issue as a "discussion" and I will leave this open.

@stale stale bot added the stale label Aug 8, 2020
@sushil5
Copy link

sushil5 commented Jul 26, 2021

@3luyka did you get any solution on this? I am also facing the same issue.

@Namnp1521
Copy link

+1 same

@allpwrfulroot
Copy link

Possible explanation from similar experience: your image gets too darn big, even as vector, especially on hi-res larger-screen devices.

We had a simple SVG resized to several times the device width/height for an animation and encountered this fatal error (in prod 🤦 ); we had been diligent about testing on older devices but less so newer flagships. Trimming down the SVG to only the parts viewable -> decreasing the dimension multiples required from 2x,4x to 1x,2.2x & adding a subtle transform so the animation effect stayed the same -> no more crashes.

Hope that helps someone!

@bohdanprog
Copy link
Member

Hello @3luyka,
If you still have that problem, please share a simple repro for that problem.
Thank you.

@bohdanprog bohdanprog added Missing repro This issue need minimum repro scenario Close when stale This issue is going to be closed when there is no activity for a while labels Jun 19, 2024
@smfunder
Copy link

smfunder commented Nov 21, 2024

hey guys, I'm getting this crash too in Android. Here are some details.
This is happening only on Release mode, I suspect because in release mode everything goes faster than in debug mode.
RN version 0.76.1 (newArch/bridgeless mode disabled)
react-native-svg 15.9.0
react-content-loader (which uses svg lib) 7.0.2

The app is crashing when rendering Home Screen which use react-content-loader. I also tried to remove all this loader component but the crash was still there.

Very few times I got in Sentry the very same stack trace as the original post here.

java.lang.IllegalArgumentException: null
    at android.graphics.LinearGradient.nativeCreate(LinearGradient.java)
    at android.graphics.LinearGradient.createNativeInstance(LinearGradient.java:156)
    at android.graphics.Shader.getNativeInstance(Shader.java:175)
    at android.graphics.Paint.getNativeInstance(Paint.java:681)
    at android.graphics.BaseCanvas.drawPath(BaseCanvas.java:327)
    at android.graphics.Canvas.drawPath(Canvas.java:1908)
    at com.horcrux.svg.RenderableView.draw(RenderableView.java:526)
    at com.horcrux.svg.RenderableView.render(RenderableView.java:487)
    at com.horcrux.svg.GroupView.drawGroup(GroupView.java:135)
    at com.horcrux.svg.GroupView.draw(GroupView.java:91)
    at com.horcrux.svg.RenderableView.render(RenderableView.java:487)
    at com.horcrux.svg.SvgView.drawChildren(SvgView.java:336)
    at com.horcrux.svg.SvgView.drawOutput(SvgView.java:282)
    at com.horcrux.svg.SvgView.onDraw(SvgView.java:135)
    at android.view.View.draw(View.java:22350)
    at com.facebook.react.views.view.ReactViewGroup.draw(ReactViewGroup.java:970)
    at android.view.View.updateDisplayListIfDirty(View.java:21226)
    at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4500)
    at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4473)
    at android.view.View.updateDisplayListIfDirty(View.java:21186)
    at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4500)
    at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4473)
    at android.view.View.updateDisplayListIfDirty(View.java:21186)
    at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4500)
    at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4473)
    at android.view.View.updateDisplayListIfDirty(View.java:21186)
    at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4500)
    at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4473)
    at android.view.View.updateDisplayListIfDirty(View.java:21186)
    at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4500)
    at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4473)
    at android.view.View.updateDisplayListIfDirty(View.java:21186)
    at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4500)
    at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4473)
    at android.view.View.updateDisplayListIfDirty(View.java:21186)
    at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4500)
    at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4473)
    at android.view.View.updateDisplayListIfDirty(View.java:21186)
    at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4500)
    at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4473)
    at android.view.View.updateDisplayListIfDirty(View.java:21186)
    at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4500)
    at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4473)
    at android.view.View.updateDisplayListIfDirty(View.java:21186)
    at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4500)
    at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4473)
    at android.view.View.updateDisplayListIfDirty(View.java:21186)
    at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4500)
    at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4473)
    at android.view.View.updateDisplayListIfDirty(View.java:21186)
    at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4500)
    at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4473)
    at android.view.View.updateDisplayListIfDirty(View.java:21186)
    at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4500)
    at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4473)
    at android.view.View.updateDisplayListIfDirty(View.java:21186)
    at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4500)
    at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4473)
    at android.view.View.updateDisplayListIfDirty(View.java:21186)
    at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4500)
    at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4473)
    at android.view.View.updateDisplayListIfDirty(View.java:21186)
    at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4500)
    at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4473)
    at android.view.View.updateDisplayListIfDirty(View.java:21186)
    at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4500)
    at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4473)
    at android.view.View.updateDisplayListIfDirty(View.java:21186)
    at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4500)
    at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4473)
    at android.view.View.updateDisplayListIfDirty(View.java:21186)
    at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4500)
    at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4473)
    at android.view.View.updateDisplayListIfDirty(View.java:21186)
    at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4500)
    at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4473)
    at android.view.View.updateDisplayListIfDirty(View.java:21186)
    at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4500)
    at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4473)
    at android.view.View.updateDisplayListIfDirty(View.java:21186)
    at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:559)
    at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:565)
    at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:642)
    at android.view.ViewRootImpl.draw(ViewRootImpl.java:4101)
    at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:3828)
    at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:3099)
    at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1952)
    at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:8171)
    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:972)
    at android.view.Choreographer.doCallbacks(Choreographer.java:796)
    at android.view.Choreographer.doFrame(Choreographer.java:731)
    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:957)
    at android.os.Handler.handleCallback(Handler.java:938)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:223)
    at android.app.ActivityThread.main(ActivityThread.java:7656)
    at java.lang.reflect.Method.invoke(Method.java)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Close when stale This issue is going to be closed when there is no activity for a while Missing repro This issue need minimum repro scenario stale
Projects
None yet
Development

No branches or pull requests

6 participants