mlkit: Barcode Scanning with CameraX not working on Android 10

I’m trying tu use this demo do test the Barcode Scanning on a Samsung Tablet with Android 10. The app read the QrCode at LivePreviewActivity, but if i chose the CameraX option the app don’t return anything. I tested the same code on a Samsung tablet with Android 8 and this bug don’t happens.

My log is filled with: Accessing hidden method Lsun/misc/Unsafe;->putInt(Ljava/lang/Object;JI)V (greylist, linking, allowed)

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 1
  • Comments: 29

Most upvoted comments

Same issue after libraries update. Tried on OnePlus 6T / Android 10

Is working with:

implementation "androidx.camera:camera-core:1.0.0-beta07"
implementation "androidx.camera:camera-camera2:1.0.0-beta07"
implementation "androidx.camera:camera-view:1.0.0-alpha14"
implementation "androidx.camera:camera-extensions:1.0.0-alpha14"
implementation "androidx.camera:camera-lifecycle:1.0.0-beta07"

Is not working with:

implementation "androidx.camera:camera-core:1.0.0-beta11"
implementation "androidx.camera:camera-camera2:1.0.0-beta11"
implementation "androidx.camera:camera-view:1.0.0-alpha18"
implementation "androidx.camera:camera-extensions:1.0.0-alpha18"
implementation "androidx.camera:camera-lifecycle:1.0.0-beta11"

Hi, BarcodeScanning with CameraX input may not work on some devices with the latest CameraX library. You can use an earlier version(pre camera-camera2:1.0.0-beta08) of camera-camera2 to bypass this issue. We will soon publish this in the Known issue session of our dev site as well. The fix for this issue will be shipped with the next mlkit barcode sdk release in Mid Dec 2020.

Hi all,

We got some clue and keep investigating on it. Will keep you posted.

Thanks!

Thanks! @polivmi1 From your description, it seems to be a cameraX not being flexible enough issue to me. For Barcode scanning and other ML vision features, we do require resolution number for the image to be recognized. Check the general guidance here. I will try to file this as an internal feature request to the camerax team.

Hi @looploooop,

I’m creating the bitmap using getBitmap(ImageProxy image) method from mlkit samples.

Then converting the bitmap to InputImage using

val image = InputImage.fromBitmap(bitmap!!, 0)