capawesome-team / capacitor-mlkit

⚡️ ML Kit plugins for Capacitor. Supports Android and iOS.
https://capawesome.io/plugins/mlkit/
Apache License 2.0
138 stars 38 forks source link

bug(barcode-scanning): Black screen on Android device #42

Closed vgrunner4v closed 11 months ago

vgrunner4v commented 1 year ago

Plugin(s)

Did you test the latest version?

Platform(s)

Current behavior

I followed the guide and tried to add it to my simple app. when i try to scan (after giving permissions), its showing black screen with the scanning square in the middle.

this is what i see on Samsung Galaxy A04e, just a black screen:

image

Expected behavior

Showing the camera preview and be able to scan barcodes.

Reproduction

https://github.com/robingenz/ionic-capacitor-barcode-scanner

Steps to reproduce

  1. clone the demo repo
  2. follow the installation guide in the README
  3. run on physical device through Android Studio
  4. open app, try to scan - black screen

Other information

Samsung Galaxy A04e with Android 13, running from android studio via Pair using WiFi

Capacitor doctor

PS J:\ionic-capacitor-barcode-scanner> npx cap doctor
[warn] The bundledWebRuntime configuration option has been deprecated. Can be safely deleted.                                        
    Capacitor Doctor
                                                                                                                                                                                                                                                 Latest Dependencies:

  @capacitor/cli: 5.0.4
  @capacitor/core: 5.0.4
  @capacitor/android: 5.0.4
  @capacitor/ios: 5.0.4

Installed Dependencies:

  @capacitor/core: 5.0.0
  @capacitor/ios: 5.0.0                                                                                                             
  @capacitor/android: 5.0.0
  @capacitor/cli: 5.0.0

[error] Missing <manifest package=""> attribute in app/src/main 

Before submitting

vgrunner4v commented 1 year ago

update: in this demo app: https://github.com/robingenz/capacitor-mlkit-plugin-demo

the Start Scan is working, but the Scan shows black screen like in the image above..

robingenz commented 1 year ago

Seems like this is an issue with the com.google.android.gms:play-services-code-scanner dependency, see https://issuetracker.google.com/issues/285007312

I can't reproduce it on my Google Pixel. I recommend using the startScan(...) method until Google fixes the problem.

vgrunner4v commented 1 year ago

@robingenz - to be able to use startScan(...) i need to create my own page / component, right? we do not use Ionic, just ReactJS (spa) with Capacitor.

robingenz commented 1 year ago

Yes, to use the startScan(...) method, you need to build the UI yourself. You don't need to use Ionic for that - just basic HTML/CSS.

vgrunner4v commented 1 year ago

Got it, thanks, seems like this is the workaound for now.

robingenz commented 1 year ago

This issue might be related to #38

robingenz commented 11 months ago

The issue can be resolved by updating Google Play Services to the latest version. If you continue to experience the same problem, you can try uninstalling and then reinstalling Google Play Services that's worked for me on my physical device and the emulator.

The issue was closed by Google. It seems like you can fix this by updating Google Play Services. For this reason i am closing this issue.