I am trying to build a bar code scanner app in Flutter. For this, I am using this plugin. I added it to pubspec.yaml
, modified the AndroidMainfest.xml
file and added the simple code as below:
Future _scanQR() async {
try {
var qrResult = await BarcodeScanner.scan();
result = qrResult as String;
} catch (ex) {
// result = "Unknown Error $ex";
}
}
The above method is invoked on a button press. So the app loads and I click the button, the whole emulator crashes without any logs or error message. Here is the whole logcat I recorded during the flow. In the end, it says
2020-04-19 20:20:21.285 1740-2027/? I/Camera2ClientBase: Camera 0: Opened. Client: io.yeshwanthvshenoy.addup (PID 4260, UID 10086)
Here is another log from the default camera app. I can't seem to find out why this is happening. My emulator settings are all default, I didn't change any setting except the back camera one which is set to Webcam0
. The possible options where virtual scene
, none
, emulated
and webcam0
. Is it maybe that my Mac is not giving permissions to AVD to access camera? How can I check that if so??