Closed burakakyol closed 9 months ago
Hey - sorry I don't really think this is related to VisionCamera.
Maybe try removing this line: https://github.com/mrousavy/react-native-vision-camera/blob/7905f2c057869698a4f5afa3182bec4cd2a5fe58/package/android/build.gradle#L145
Hey - did you try to remove this line? If yes, did it work?
Hi @mrousavy I'm sorry for not getting back to you sooner.
We removed the line you mentioned, but it didn't work. I'll get back to you tomorrow with the details.
Thank you.
Okay thanks - let me know because this is weird haven't seen this before
Hi @mrousavy
I removed the line you mentioned. However, I got a different crash from the application.
couldn't find DSO to load: libjscexecutor.so
SoSource 0: com.facebook.soloader.ApkSoSource[root = /data/data/tr.sisal.streetvendor.test/lib-main flags = 1]
SoSource 1: com.facebook.soloader.DirectorySoSource[root = /data/app/~~jU4dZ_nfHW8CmZVGk6dvLA==/tr.sisal.streetvendor.test-OPAHM0LywtyiQJVkT_Q7UQ==/lib/arm64 flags = 0]
SoSource 2: com.facebook.soloader.DirectorySoSource[root = /system/lib64 flags = 2]
SoSource 3: com.facebook.soloader.DirectorySoSource[root = /vendor/lib64 flags = 2]
Native lib dir: /data/app/~~jU4dZ_nfHW8CmZVGk6dvLA==/tr.sisal.streetvendor.test-OPAHM0LywtyiQJVkT_Q7UQ==/lib/arm64
result: 0
libjscexecutor.so is also different .so file that is placed in the gradle file of the library. Should I remove it ?
1) first install this in your device npm install @react-native-camera/core @react-native-camera/barcode 2)make sure you have linked the packages correctly. If you are using React Native 0.60 or above, auto-linking should work. 3)try this code according to your preferences;
import React, { useEffect, useState } from 'react'; import { StyleSheet, View, Dimensions, Image } from 'react-native'; import Camera from '@react-native-camera/core'; import BarcodeMask from '@react-native-camera/barcode-mask'; import { useCameraDevice } from '@react-native-camera/core';
const CameraScreen = () => { const device = useCameraDevice('back'); const [barCode, setBarCode] = useState('');
const handleBarCodeRead = (e) => { setBarCode(e.data); };
useEffect(() => { if (barCode !== '') { // Your code here, for example: // navigate to a new screen and pass the barCode value } }, [barCode]);
return (
); };
const styles = StyleSheet.create({ container: { flex: 1, }, overlay: { position: 'absolute', top: 0, left: 0, right: 0, bottom: 0, backgroundColor: 'rgba(0, 0, 0, 0.5)', justifyContent: 'center', alignItems: 'center', }, warningImage: { width: 40, height: 40, }, warningText: { color: 'white', fontSize: 16, marginTop: 20, }, });
export default CameraScreen;
Hey - sorry but I read the crash logs again and there is nothing related to VisionCamera. You can try uninstalling VisionCamera and probably get the same error.
This is due to something stripping away native libraries (probably ProGuard)
We solved the issue by applying the dexguard rules below:
-keepresourcefiles lib/**/libfb*.so,lib/**/libreact*.so,lib/**/libyoga*.so,lib/**/libhermes.so,lib/**/libhermes_executor.so,lib/**/libjsi*.so,*/lib/**/libfb*.so,*/lib/**/libreact*.so,*/lib/**/libyoga*.so,*/lib/**/libhermes.so,*/lib/**/libhermes_executor.so,*/lib/**/libjsi*.so
What's happening?
We're using vision-camera for scanning the barcode. We had no error while running on debug and release mode and the application worked as expected when the obfuscation was disabled. However, after obfuscating the application by using dexguard(enterprise proguard) , the application started to crash on splash screen. I couldn't find any keep rule in the documentation.
Before installing the library, there was no crash in the application.
Reproduceable Code
Relevant log output
Camera Device
Device
Redmi Note 11 ( Android 11), Galaxy A32 ( Android 11)
VisionCamera Version
3.6.13
Can you reproduce this issue in the VisionCamera Example app?
No, I cannot reproduce the issue in the Example app
Additional information