React-native-fast-image: App crash: "java.lang.IllegalArgumentException: You cannot start a load for a destroyed activity"

Created on 12 Jul 2018  路  13Comments  路  Source: DylanVann/react-native-fast-image

Description

In the firebase I noticed that many users are facing this crash. I suppose that it is caused by react-native-fast-image component as it is probably the only component in my project using glide. Due to logs I suppose this is the problem.

Reproduce

Unfortunately I couldn't reproduce this error. It sometimes happens randomly when user navigates to the component that uses fastimage.

Firebase Log

Exception java.lang.IllegalArgumentException: You cannot start a load for a destroyed activity com.bumptech.glide.manager.RequestManagerRetriever.assertNotDestroyed (RequestManagerRetriever.java:302) com.bumptech.glide.manager.RequestManagerRetriever.get (RequestManagerRetriever.java:148) com.bumptech.glide.manager.RequestManagerRetriever.get (RequestManagerRetriever.java:114) com.bumptech.glide.manager.RequestManagerRetriever.get (RequestManagerRetriever.java:116) com.bumptech.glide.Glide.with (Glide.java:609) com.dylanvann.fastimage.FastImageViewManager.createViewInstance (FastImageViewManager.java:59) com.dylanvann.fastimage.FastImageViewManager.createViewInstance (FastImageViewManager.java:43) com.facebook.react.uimanager.ViewManager.createView (ViewManager.java:44) com.facebook.react.uimanager.NativeViewHierarchyManager.createView (NativeViewHierarchyManager.java:224) com.facebook.react.uimanager.UIViewOperationQueue$CreateViewOperation.execute (UIViewOperationQueue.java:153) com.facebook.react.uimanager.UIViewOperationQueue$1.run (UIViewOperationQueue.java:813) com.facebook.react.uimanager.UIViewOperationQueue.flushPendingBatches (UIViewOperationQueue.java:926) com.facebook.react.uimanager.UIViewOperationQueue.access$2100 (UIViewOperationQueue.java:47) com.facebook.react.uimanager.UIViewOperationQueue$2.runGuarded (UIViewOperationQueue.java:884) com.facebook.react.bridge.GuardedRunnable.run (GuardedRunnable.java:21) android.os.Handler.handleCallback (Handler.java:739) android.os.Handler.dispatchMessage (Handler.java:95) android.os.Looper.loop (Looper.java:158) android.app.ActivityThread.main (ActivityThread.java:7230) java.lang.reflect.Method.invoke (Method.java) com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1230) com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1120)

Solution idea

I found out that people are facing similar problems loading images using glide:

Most helpful comment

@miraan https://github.com/DylanVann/react-native-fast-image/pull/272

I maintain my own fork of this library, you could do the same (https://www.npmjs.com/package/@n1ru4l/react-native-fast-image)

yarn add react-native-fast-image@npm:@n1ru4l/[email protected]

Here a diff of all changes between master and my "private" release:

https://github.com/DylanVann/react-native-fast-image/compare/master...n1ru4l:private-release

All 13 comments

e.. how to resolve it

@jliberacki @banli17 does this only happen in development or also in production builds=

I didn't face this problem on development for now, only on production builds

@n1ru4l in development , i did not test production锛宎fter install this plugin and link锛寃hen react-native run-android it's crash

rn0.56

Also having this issue but only in production. Can't reproduce debugging. Anyone find a fix?

@miraan https://github.com/DylanVann/react-native-fast-image/pull/272

I maintain my own fork of this library, you could do the same (https://www.npmjs.com/package/@n1ru4l/react-native-fast-image)

yarn add react-native-fast-image@npm:@n1ru4l/[email protected]

Here a diff of all changes between master and my "private" release:

https://github.com/DylanVann/react-native-fast-image/compare/master...n1ru4l:private-release

@n1ru4l amazing thank you, will try this!

I meet the same problem. Help

Same here!

    --------- beginning of crash
10-27 10:02:28.177 6421-6421/com.myapp E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.myapp, PID: 6421
    java.lang.IllegalArgumentException: You cannot start a load for a destroyed activity
        at com.bumptech.glide.manager.RequestManagerRetriever.assertNotDestroyed(RequestManagerRetriever.java:323)
        at com.bumptech.glide.manager.RequestManagerRetriever.get(RequestManagerRetriever.java:157)
        at com.bumptech.glide.manager.RequestManagerRetriever.get(RequestManagerRetriever.java:118)
        at com.bumptech.glide.manager.RequestManagerRetriever.get(RequestManagerRetriever.java:120)
        at com.bumptech.glide.Glide.with(Glide.java:698)
        at com.dylanvann.fastimage.FastImageViewManager.createViewInstance(FastImageViewManager.java:42)
        at com.dylanvann.fastimage.FastImageViewManager.createViewInstance(FastImageViewManager.java:27)
        at com.facebook.react.uimanager.ViewManager.createView(ViewManager.java:42)
        at com.facebook.react.uimanager.NativeViewHierarchyManager.createView(NativeViewHierarchyManager.java:223)
        at com.facebook.react.uimanager.UIViewOperationQueue$CreateViewOperation.execute(UIViewOperationQueue.java:152)
        at com.facebook.react.uimanager.UIViewOperationQueue$1.run(UIViewOperationQueue.java:815)
        at com.facebook.react.uimanager.UIViewOperationQueue.flushPendingBatches(UIViewOperationQueue.java:928)
        at com.facebook.react.uimanager.UIViewOperationQueue.access$2100(UIViewOperationQueue.java:46)
        at com.facebook.react.uimanager.UIViewOperationQueue$2.runGuarded(UIViewOperationQueue.java:886)
        at com.facebook.react.bridge.GuardedRunnable.run(GuardedRunnable.java:21)
        at android.os.Handler.handleCallback(Handler.java:751)
        at android.os.Handler.dispatchMessage(Handler.java:95)
        at android.os.Looper.loop(Looper.java:154)
        at android.app.ActivityThread.main(ActivityThread.java:6119)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
"react-native": "~0.55.2",
"react-native-fast-image": "^5.0.10",

https://github.com/DylanVann/react-native-fast-image/issues/27

We experience the same:

#0. Crashed: main
       at com.facebook.react.bridge.ReactContext.handleException(ReactContext.java:311)
       at com.facebook.react.bridge.GuardedRunnable.run(GuardedRunnable.java:23)
       at android.os.Handler.handleCallback(Handler.java:751)
       at android.os.Handler.dispatchMessage(Handler.java:95)
       at android.os.Looper.loop(Looper.java:154)
       at android.app.ActivityThread.main(ActivityThread.java:6123)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:757)

--

Fatal Exception: java.lang.RuntimeException: java.lang.IllegalArgumentException: You cannot start a load for a destroyed activity
       at com.facebook.react.bridge.ReactContext.handleException(ReactContext.java:311)
       at com.facebook.react.bridge.GuardedRunnable.run(GuardedRunnable.java:23)
       at android.os.Handler.handleCallback(Handler.java:751)
       at android.os.Handler.dispatchMessage(Handler.java:95)
       at android.os.Looper.loop(Looper.java:154)
       at android.app.ActivityThread.main(ActivityThread.java:6123)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:757)

Caused by java.lang.IllegalArgumentException: You cannot start a load for a destroyed activity
       at com.bumptech.glide.manager.RequestManagerRetriever.assertNotDestroyed(RequestManagerRetriever.java:323)
       at com.bumptech.glide.manager.RequestManagerRetriever.get(RequestManagerRetriever.java:157)
       at com.bumptech.glide.manager.RequestManagerRetriever.get(RequestManagerRetriever.java:118)
       at com.bumptech.glide.manager.RequestManagerRetriever.get(RequestManagerRetriever.java:120)
       at com.bumptech.glide.Glide.with(Glide.java:698)
       at com.dylanvann.fastimage.FastImageViewManager.createViewInstance(FastImageViewManager.java:42)
       at com.dylanvann.fastimage.FastImageViewManager.createViewInstance(FastImageViewManager.java:27)
       at com.facebook.react.uimanager.ViewManager.createView(ViewManager.java:42)
       at com.facebook.react.uimanager.NativeViewHierarchyManager.createView(NativeViewHierarchyManager.java:223)
       at com.facebook.react.uimanager.UIViewOperationQueue$CreateViewOperation.execute(UIViewOperationQueue.java:152)
       at com.facebook.react.uimanager.UIViewOperationQueue$1.run(UIViewOperationQueue.java:815)
       at com.facebook.react.uimanager.UIViewOperationQueue.flushPendingBatches(UIViewOperationQueue.java:928)
       at com.facebook.react.uimanager.UIViewOperationQueue.access$2100(UIViewOperationQueue.java:46)
       at com.facebook.react.uimanager.UIViewOperationQueue$2.runGuarded(UIViewOperationQueue.java:886)
       at com.facebook.react.bridge.GuardedRunnable.run(GuardedRunnable.java:21)
       at android.os.Handler.handleCallback(Handler.java:751)
       at android.os.Handler.dispatchMessage(Handler.java:95)
       at android.os.Looper.loop(Looper.java:154)
       at android.app.ActivityThread.main(ActivityThread.java:6123)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:757)
react-native: 0.55.4 
react-native-fast-image: 5.0.11

This seems like it might be resolved in a recent commit.

@DylanVann, any ideas on when this might be part of an official release?

I same

@miraan #272

I maintain my own fork of this library, you could do the same (https://www.npmjs.com/package/@n1ru4l/react-native-fast-image)

yarn add react-native-fast-image@npm:@n1ru4l/[email protected]

Here a diff of all changes between master and my "private" release:

master...n1ru4l:private-release

thank bro.

Was this page helpful?
0 / 5 - 0 ratings