jc28
jc28

Reputation: 1882

Is it real to find the crash by stacktrace from crashlytics in React Native Android app?

Every day I face with a lot of crash reports from the production mode by crashlytics on Android React Native. It is not possible to detect this crashes in the develop mode. Just stacktrace from firebase. And all this stacks describes what is happening on the native Java's side. By the name of the exception we can assume the approximate cause of the error. Some methods that was called before the crash and numbers of the lines that say nothing for you. And more over this methods could be called in so many places of the app, even in the third party libraries. In some lucky cases you can find the same errors maybe on GitHub or StackOverflow, but it is all individually, because if it works somewhere it does not mean it will work in your situation. And every day I try find the cause of the error in React Native app by test in many places of my app, but nothing to find there even if I now the approximate cause of the error from the stacktrace. Can somebody tell me please is it possible to detect the exact line code from Java side in React Native by this stacktrace or it is not enough information for it. Maybe to share your experience or recommend something how to go ahead at this. Thanks in advance!

Fatal Exception: android.view.WindowManager$BadTokenException: Unable to add window -- token android.os.BinderProxy@5f1e209 is not valid; is your activity running?
       at android.view.ViewRootImpl.setView(ViewRootImpl.java:1122)
       at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:439)
       at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:95)
       at android.app.Dialog.show(Dialog.java:473)
       at com.facebook.react.views.modal.ReactModalHostView.showOrUpdate(ReactModalHostView.java:307)
       at com.facebook.react.views.modal.ReactModalHostManager.onAfterUpdateTransaction(ReactModalHostManager.java:137)
       at com.facebook.react.views.modal.ReactModalHostManager.onAfterUpdateTransaction(ReactModalHostManager.java:30)
       at com.facebook.react.uimanager.ViewManager.updateProperties(ViewManager.java:51)
       at com.facebook.react.uimanager.NativeViewHierarchyManager.createView(NativeViewHierarchyManager.java:279)
       at com.facebook.react.uimanager.UIViewOperationQueue$CreateViewOperation.execute(UIViewOperationQueue.java:180)
       at com.facebook.react.uimanager.UIViewOperationQueue$1.run(UIViewOperationQueue.java:786)
       at com.facebook.react.uimanager.UIViewOperationQueue.flushPendingBatches(UIViewOperationQueue.java:903)
       at com.facebook.react.uimanager.UIViewOperationQueue.access$2400(UIViewOperationQueue.java:43)
       at com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.doFrameGuarded(UIViewOperationQueue.java:963)
       at com.facebook.react.uimanager.GuardedFrameCallback.doFrame(GuardedFrameCallback.java:29)
       at com.facebook.react.modules.core.ReactChoreographer$ReactChoreographerDispatcher.doFrame(ReactChoreographer.java:175)
       at com.facebook.react.modules.core.ChoreographerCompat$FrameCallback$1.doFrame(ChoreographerCompat.java:85)
       at android.view.Choreographer$CallbackRecord.run(Choreographer.java:994)
       at android.view.Choreographer.doCallbacks(Choreographer.java:794)
       at android.view.Choreographer.doFrame(Choreographer.java:725)
       at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:981)
       at android.os.Handler.handleCallback(Handler.java:883)
       at android.os.Handler.dispatchMessage(Handler.java:100)
       at android.os.Looper.loop(Looper.java:237)
       at android.app.ActivityThread.main(ActivityThread.java:7814)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1075)
Fatal Exception: java.lang.OutOfMemoryError
       at android.graphics.Bitmap.nativeCreate(Bitmap.java)
       at android.graphics.Bitmap.createBitmap(Bitmap.java:1095)
       at android.graphics.Bitmap.createBitmap(Bitmap.java:1041)
       at android.graphics.Bitmap.createBitmap(Bitmap.java:991)
       at android.graphics.Bitmap.createBitmap(Bitmap.java:952)
       at com.facebook.imagepipeline.memory.BucketsBitmapPool.alloc(BucketsBitmapPool.java:54)
       at com.facebook.imagepipeline.memory.BucketsBitmapPool.alloc(BucketsBitmapPool.java:29)
       at com.facebook.imagepipeline.memory.BasePool.get(BasePool.java:266)
       at com.facebook.imagepipeline.platform.DefaultDecoder.decodeFromStream(DefaultDecoder.java:217)
       at com.facebook.imagepipeline.platform.DefaultDecoder.decodeJPEGFromEncodedImageWithColorSpace(DefaultDecoder.java:155)
       at com.facebook.imagepipeline.decoder.DefaultImageDecoder.decodeJpeg(DefaultImageDecoder.java:181)
       at com.facebook.imagepipeline.decoder.DefaultImageDecoder$1.decode(DefaultImageDecoder.java:58)
       at com.facebook.imagepipeline.decoder.DefaultImageDecoder.decode(DefaultImageDecoder.java:121)
       at com.facebook.imagepipeline.producers.DecodeProducer$ProgressiveDecoder.doDecode(DecodeProducer.java:281)
       at com.facebook.imagepipeline.producers.DecodeProducer$ProgressiveDecoder.access$200(DecodeProducer.java:128)
       at com.facebook.imagepipeline.producers.DecodeProducer$ProgressiveDecoder$1.run(DecodeProducer.java:170)
       at com.facebook.imagepipeline.producers.JobScheduler.doJob(JobScheduler.java:202)
       at com.facebook.imagepipeline.producers.JobScheduler.access$000(JobScheduler.java:22)
       at com.facebook.imagepipeline.producers.JobScheduler$1.run(JobScheduler.java:73)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
       at com.facebook.imagepipeline.core.PriorityThreadFactory$1.run(PriorityThreadFactory.java:51)
       at java.lang.Thread.run(Thread.java:764)

Upvotes: 0

Views: 358

Answers (1)

Muhammad Umer Qadri
Muhammad Umer Qadri

Reputation: 259

First of all, try using try catch statements on all those places which you think can cause the crash like api calls, async functions, data processing etc.

There are multiple activity tracking sdk available out there for tracking activities like:

AppsFlyer: https://www.appsflyer.com/

Leanplum: https://www.leanplum.com/

CleverTap: https://clevertap.com/

You can use any of these sdk to track events/activities/errors. This will help you to identify steps to reproduce crash and sometimes this can provide you actual error message by passing it to the activity/event. You can get the error message in catch block and then pass that error message with the activity/event to the sdk.

Upvotes: 1

Related Questions