Closed Nandha-d3v closed 10 months ago
Upgrading react-native-worklets-core to 0.2.4 helped me. And dont forget check that you added ["react-native-worklets-core/plugin"], to babel.config.js
I tried that, but it is still same. The app crahses after the code is scanned in Release build. Please take a look at this @mgcrea @joratapok
@Nandha-d3v I retried a release build without issues. It looks like the issue comes from your JavaScript code so try to remove any custom logic in the callbacks and see if it crashes.
You can also try to build the example (https://github.com/mgcrea/vision-camera-barcode-scanner/tree/master/example) project in release mode to see if you are still experiencing a crash.
Otherwise I will need a minimal reproducible test case to look more into it.
What's happening?
The camera worked fine when using in development mode. I was even able to scan couple of Barcodes and do everything as expected. But the moment I launch the camera in Release Build it crashes Without @mgcrea/vision-camera-barcode-scanner it worked fine in release mode to, but after adding it I saw the crash on release mode. Dev mode works fine though.
I'm using "@mgcrea/vision-camera-barcode-scanner": "^0.6.3", "react-native-vision-camera": "^3.6.4", And I have "react-native-worklets-core": "^0.2.2",
Here is the code sample
`import {Worklets} from 'react-native-worklets-core'; import { Camera, useCameraDevice, } from 'react-native-vision-camera'; import { CameraHighlights, useBarcodeScanner, } from '@mgcrea/vision-camera-barcode-scanner';
======> const device = useCameraDevice('back');
const assignBarCodesJs = Worklets.createRunInJsFn(assignBarCodes);
const {props: cameraProps, highlights} = useBarcodeScanner({ fps: 2, barcodeTypes: [ 'ean-13', 'code-128', 'code-39', 'code-93', 'codabar', 'ean-8', 'itf', 'upc-e', ], // optional //scanMode: "once", regionOfInterest: { x: 0, y: 0.5, width: 1, height: 0.2, }, onBarcodeScanned: codes => { 'worklet'; if (codes.length) { assignBarCodesJs(codes); } }, });
===>Camera component ====>>> <Camera style={StyleSheet.absoluteFill} device={device} isActive={keepScanning} audio={false} {...cameraProps} />`
Here is the relevant log output
--------- beginning of crash 10-27 22:35:16.874 32037 32283 E AndroidRuntime: FATAL EXCEPTION: mrousavy/VisionCamera.video 10-27 22:35:16.874 32037 32283 E AndroidRuntime: Process: com.myapp, PID: 32037 10-27 22:35:16.874 32037 32283 E AndroidRuntime: com.facebook.jni.CppException: Compiling JS failed: 1:1:invalid empty parentheses '( )' Buffer size 3 starts with: 280a29 10-27 22:35:16.874 32037 32283 E AndroidRuntime: at com.mrousavy.camera.frameprocessor.FrameProcessor.call(Native Method) 10-27 22:35:16.874 32037 32283 E AndroidRuntime: at com.mrousavy.camera.core.VideoPipeline._init_$lambda$0(VideoPipeline.kt:111) 10-27 22:35:16.874 32037 32283 E AndroidRuntime: at com.mrousavy.camera.core.VideoPipeline.$r8$lambda$EMriwS_FKhtjTFtppM84Z5V8tiI(Unknown Source:0) 10-27 22:35:16.874 32037 32283 E AndroidRuntime: at com.mrousavy.camera.core.VideoPipeline$$ExternalSyntheticLambda0.onImageAvailable(Unknown Source:2) 10-27 22:35:16.874 32037 32283 E AndroidRuntime: at android.media.ImageReader$1.run(ImageReader.java:916) 10-27 22:35:16.874 32037 32283 E AndroidRuntime: at android.os.Handler.handleCallback(Handler.java:942) 10-27 22:35:16.874 32037 32283 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:99) 10-27 22:35:16.874 32037 32283 E AndroidRuntime: at android.os.Looper.loopOnce(Looper.java:226) 10-27 22:35:16.874 32037 32283 E AndroidRuntime: at android.os.Looper.loop(Looper.java:313) 10-27 22:35:16.874 32037 32283 E AndroidRuntime: at android.os.HandlerThread.run(HandlerThread.java:67) 10-27 22:35:16.884 32037 32283 I Process : Sending signal. PID: 32037 SIG: 9
### Tested on iPhone 13 Pro Max, iPhone 15, Samsung Galaxy S22