Skip to content

Android crash - Illegal callback invocation from native module - RuntimeException firing twice #113

@scgough

Description

@scgough

I've been trying to get to the bottom of this issue. I've seen it over on the old repo and there's not been a good solution for it.

On certain devices...namely Realme, Oppo and Huawei a regular crash seems to be occurring. I've tested using a "Realme 7" phone, Android 11 and can reproduce it every time w/ the below scenario.

The issue seems to be triggered if you re-download a previously downloaded item again and you have addAndroidDownloads: path set.

Upon completing the 2nd download onReceive seems to fire twice.
The following line is called:

this.callback.invoke(null, ReactNativeBlobUtilConst.RNFB_RESPONSE_PATH, customDest);

At this point in time this.callback.mInvoked is true which fires an exception taking you to line 808 which attempts to fire another callback and causes the crash:

this.callback.invoke(ex.getLocalizedMessage(), null);

I can get this issue to stop happening if I change the path supplied to be unique so I'm wondering if this is something to do with this value or maybe the source file Url?

I'd love to figure out exactly why this is happening! Has anyone else seen this?

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions