juliuscanute / qr_code_scanner

QR Code Scanner for Flutter
BSD 2-Clause "Simplified" License
1.01k stars 799 forks source link

Camera black screen after reopening #548

Closed Aboneyx closed 2 years ago

Aboneyx commented 2 years ago

The camera works only once after the apk dish. The camera shows a black screen after reopening. This has happened since version 1.0.0. And I can't downgrade the package version, since the flutter is 3.0.0.

Flutter information [✓] Flutter (Channel stable, 3.0.0, on macOS 12.4 21F79 darwin-arm, locale ru-KZ) • Flutter version 3.0.0 at /Users/rayyvon/FlutterDev/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision ee4e09cce0 (3 weeks ago), 2022-05-09 16:45:18 -0700 • Engine revision d1b9a6938a • Dart version 2.17.0 • DevTools version 2.12.2

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0-rc4) • Android SDK at /Users/rayyvon/Library/Android/sdk • Platform android-32, build-tools 33.0.0-rc4 • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189) • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.3) • Xcode at /Applications/Xcode.app/Contents/Developer • CocoaPods version 1.11.3

[✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2020.3) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)

[✓] VS Code (version 1.67.2) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.40.0

[✓] Connected device (3 available) • EVA AL10 (mobile) • KWG5T16906028969 • android-arm64 • Android 8.0.0 (API 26) • macOS (desktop) • macos • darwin-arm64 • macOS 12.4 21F79 darwin-arm • Chrome (web) • chrome • web-javascript • Google Chrome 101.0.4951.64

[✓] HTTP Host Availability • All required HTTP hosts are available

juliansteenbakker commented 2 years ago

On which device are you experiencing this?

theamorn commented 2 years ago

I have the problem as well here's my flutter doctor

[✓] Flutter (Channel stable, 3.0.1, on macOS 12.4 21F79 darwin-arm, locale en-TH) • Flutter version 3.0.1 at /Users/amorn/development/flutter_arm64 • Upstream repository https://github.com/flutter/flutter.git • Framework revision fb57da5f94 (11 days ago), 2022-05-19 15:50:29 -0700 • Engine revision caaafc5604 • Dart version 2.17.1 • DevTools version 2.12.2

[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1) • Android SDK at /Users/amorn/Library/Android/sdk • Platform android-32, build-tools 32.1.0-rc1 • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840) • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.4) • Xcode at /Applications/Xcode.app/Contents/Developer • CocoaPods version 1.11.3

[✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.2) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)

[✓] VS Code (version 1.67.2) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.40.0

[✓] Connected device (3 available) • M2103K19G (mobile) • obsg7horzxfe4du8 • android-arm64 • Android 12 (API 31) • macOS (desktop) • macos • darwin-arm64 • macOS 12.4 21F79 darwin-arm • Chrome (web) • chrome • web-javascript • Google Chrome 101.0.4951.64

[✓] HTTP Host Availability • All required HTTP hosts are available

my device is a Redmi note 10 5G. it's a black screen at first but the screen will show up after I use the photo in the gallery, and the camera will pop up normally. You can just click to gallery and back to the camera, it will start the camera black screen on both 0.7.0 and 1.0.0 so I think it's about Flutter that conflict with this lib

Another thing is can you change androidminSDK to 31 instead of 32? so it's followed with Flutter that requires 31. 32 is too new. Thanks

christianfl commented 2 years ago

This should help. had the same issue:

https://github.com/juliuscanute/qr_code_scanner/issues/538#issuecomment-1133883828

Aboneyx commented 2 years ago

On which device are you experiencing this?

Huawei P9 (Android 8) Huawei P Smart (Android 10) Samsung A12 (Android 10)

everything works correctly on ios os, but it doesn't work correctly on any androids

theamorn commented 2 years ago

This should help. had the same issue:

#538 (comment)

confirm that this link is solved my problem, I just add one line of code

controller.resumeCamera(); that's all

Aboneyx commented 2 years ago

This should help. had the same issue: #538 (comment)

confirm that this link is solved my problem, I just add one line of code

controller.resumeCamera(); that's all

Oh, it really helped, but still, if there is time, it is desirable to change the package to a mobile_scanner