简体   繁体   中英

Expo's BarCodeScanner crashes when sacaning using the build

App crashes when scanning a barcode using Expo's BarCodeScanner

I am very new to programming and expo, so I apologize in advance for the lack of precision.
I made an application using Expo 34.0.1 where I use expo's expo-barcode-scanner . The app works perfectly on expo start ; however, when I run expo build:android the scanning fails. The camera opens but as soon as a code is scanned, the app restarts.

(I didn't test it on IOS)

"expo": "^34.0.1",
"react-native": "https://github.com/expo/react-native/archive/sdk-34.0.0.tar.gz",
"sdkVersion": "33.0.0",
import { BarCodeScanner } from 'expo-barcode-scanner';
import * as Permissions from 'expo-permissions';
<BarCodeScanner
        onBarCodeScanned={this.handleBarCodeScanned}
        style={StyleSheet.absoluteFill}
>
</BarCodeScanner>

I expect it to work as in development but instead the app restarts as soon as a code is scanned

Thank you!

The issue is from how your permission is set. You need to check where your permission is being called from. I have mine being called from componentWillMount()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM