Closed mare95 closed 10 months ago
I started to face this issue when trying to access the camera component multi times after this release https://github.com/mrousavy/react-native-vision-camera/releases/tag/v3.6.7, probably due the first bug fixed described
I also have cases of this occurring on Android 12 and 13 at least.
Agreed, this PR likely causes the crash: https://github.com/mrousavy/react-native-vision-camera/pull/2174
This is the cause of over 85% of all Android crashes in my production app.
Hi, I am also facing the same problem on version 3.6.10.
I don't reproduce it myself, but I see logs uploaded to Firebase.
https://github.com/mrousavy/react-native-vision-camera/issues/2243#issuecomment-1842920769
Can anyone else try this workaround?
I'll give it a go.
It seems to help at least! Seeing probably an order of magnitude fewer crashes from what I can tell so far.
My version of the solution:
const codeScanner = useCodeScanner({
codeTypes: barcodeFormats,
onCodeScanned: (codes: Code[], frame: CodeScannerFrame) => {
if (codes.length) {
actOnBestFitCode(codes, frame);
}
},
});
where actOnBestFitCode
is still a useCallback which sets state and has a few items in the dependency array.
The key being that onCodeScanned is defined directly rather than as a variable that gets re-created.
I'll give it a go as well since i have 500+ crashes in total. If would be good to reduce number of crashes for the beginning. Thanks for sharing your insights @tahaipek @spsaucier š
Now that it's been used for longer, I think it helps but is not a cure-all. Still seeing Exception java.lang.IllegalStateException: Session has been closed; further changes are illegal.
as nearly half of all Android crashes.
In 2 days of testing, I have not encountered any errors. For now, I have implemented it as a temporary solution. I am open to new suggestions until a permanent solution is developed.
Hey! Thanks for reporting this issue.
I've been working the past days on making sure the Camera lifecycle is safely handled and released when needed to make sure this crash doesn't occur anymore.
I just created a PR for this - can you please this to see if that fixes the issue for you? https://github.com/mrousavy/react-native-vision-camera/pull/2339
If this fixes your issue, please consider š sponsoring me on GitHub š to support me / thank me for building VisionCamera and continuously improving it.
If this does not fix your issue, please clone the repo, check out the branch fix/blackscreen
(the PR above), run the Example app, reproduce your issue there and share the adb logcat
logs with me (upload to pastebin or gist) so I can investigate this further.
Thank you! š
on 3.9.1 it's happening again I'm just using simple camera
<Camera ref={cameraRef} style={styles.camera} device={device} format={format} isActive={isFocused} photo zoom={scale} onInitialized={handleInitialized} onError={handleError} />
Can you try if this is fixed in latest V4 beta?
my react-native version is 0.72.3, when I update in latest V4, it cant run the program
What's happening?
App crashes on older android devices (eg Nokia 8, Android 8) Can't reproduce this on my android device but I see lot's of crashes in Firebase Crashlytics
Reproduceable Code
Relevant log output
Camera Device
Device
Nokia 8
VisionCamera Version
3.6.8
Can you reproduce this issue in the VisionCamera Example app?
I didn't try (ā ļø your issue might get ignored & closed if you don't try this)
Additional information