microg / GmsCore

Free implementation of Play Services
https://microg.org
Apache License 2.0
8.61k stars 1.73k forks source link

[be.ugent.zeus.hydra] Barcode scanner does not work (com.google.mlkit.common.MlKitException) #1753

Open redfast00 opened 2 years ago

redfast00 commented 2 years ago

Affected app Name: Hydra Package id: be.ugent.zeus.hydra

Describe the bug

When tapping the barcode scan button, it shows a toast with 'Network failure' and the following logs show up in logcat:

07-28 22:58:31.336 10700 10700 E FormActivity: Error while getting data.
07-28 22:58:31.336 10700 10700 E FormActivity: com.google.mlkit.common.MlKitException: Code scanner module is not supported on current Google Play Services version, please upgrade.
07-28 22:58:31.336 10700 10700 E FormActivity:     at be.ugent.zeus.hydra.common.barcode.GoogleBarcodeScanner.getBarcode(GoogleBarcodeScanner.java:42)
07-28 22:58:31.336 10700 10700 E FormActivity:     at be.ugent.zeus.hydra.wpi.tap.cart.CartActivity.lambda$onCreate$0(CartActivity.java:5)
07-28 22:58:31.336 10700 10700 E FormActivity:     at be.ugent.zeus.hydra.wpi.tap.cart.CartActivity.n(Unknown Source:0)
07-28 22:58:31.336 10700 10700 E FormActivity:     at be.ugent.zeus.hydra.feed.cards.event.a.onClick(Unknown Source:18)
07-28 22:58:31.336 10700 10700 E FormActivity:     at android.view.View.performClick(View.java:7455)
07-28 22:58:31.336 10700 10700 E FormActivity:     at com.google.android.material.button.MaterialButton.performClick(MaterialButton.java:2)
07-28 22:58:31.336 10700 10700 E FormActivity:     at android.view.View.performClickInternal(View.java:7432)
07-28 22:58:31.336 10700 10700 E FormActivity:     at android.view.View.access$3700(View.java:835)
07-28 22:58:31.336 10700 10700 E FormActivity:     at android.view.View$PerformClick.run(View.java:28810)
07-28 22:58:31.336 10700 10700 E FormActivity:     at android.os.Handler.handleCallback(Handler.java:938)
07-28 22:58:31.336 10700 10700 E FormActivity:     at android.os.Handler.dispatchMessage(Handler.java:99)
07-28 22:58:31.336 10700 10700 E FormActivity:     at android.os.Looper.loopOnce(Looper.java:201)
07-28 22:58:31.336 10700 10700 E FormActivity:     at android.os.Looper.loop(Looper.java:288)
07-28 22:58:31.336 10700 10700 E FormActivity:     at android.app.ActivityThread.main(ActivityThread.java:7870)
07-28 22:58:31.336 10700 10700 E FormActivity:     at java.lang.reflect.Method.invoke(Native Method)
07-28 22:58:31.336 10700 10700 E FormActivity:     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
07-28 22:58:31.336 10700 10700 E FormActivity:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)

To Reproduce Steps to reproduce the behavior:

  1. Go to 'Settings', 'About'
  2. Tap 'Made by Zeus WPI' twice to unlock Zeus mode
  3. Exit 'Settings', go to the new 'Zeus mode' entry
  4. Fill in credentials in 'Manage login data' in the top right of the app
  5. Press 'Order', then 'Scan'
  6. It now logs com.google.mlkit.common.MlKitException: Code scanner module is not supported on current Google Play Services version, please upgrade. in logcat

Expected behavior

I expect a barcode reader window to show, letting me scan barcodes

System Android Version: 12 Custom ROM: LineageOS 19.1 MicroG

microG microG Core version: 0.2.24.214816 microG Self-Check results: All ticked

Additional context

The app is open-source, that might make testing easier. See https://github.com/ZeusWPI/hydra-android

Danacus commented 2 years ago

I think MLKit has not (yet?) been implemented in microg.

ltguillaume commented 2 years ago

Same here, for my (currently useless) banking app:

9 times the following:
E/AndroidRuntime(29268): FATAL EXCEPTION: pool-25-thread-1
E/AndroidRuntime(29268): Process: [my.bank'sapp], PID: 29268
E/AndroidRuntime(29268): java.lang.IllegalStateException: MlKitContext has not been initialized
E/AndroidRuntime(29268):    at com.google.android.gms.common.internal.Preconditions.checkState(com.google.android.gms:play-services-basement@@18.0.0:2)
E/AndroidRuntime(29268):    at com.google.mlkit.common.sdkinternal.MlKitContext.getInstance(com.google.mlkit:common@@18.1.0:1)
E/AndroidRuntime(29268):    at com.google.android.gms.internal.mlkit_vision_common.zzkb.create(com.google.mlkit:vision-common@@17.1.0:3)
E/AndroidRuntime(29268):    at com.google.mlkit.common.sdkinternal.LazyInstanceMap.get(com.google.mlkit:common@@18.1.0:3)
E/AndroidRuntime(29268):    at com.google.android.gms.internal.mlkit_vision_common.zzkc.zza(com.google.mlkit:vision-common@@17.1.0:2)
E/AndroidRuntime(29268):    at com.google.android.gms.internal.mlkit_vision_common.zzkc.zzb(com.google.mlkit:vision-common@@17.1.0:3)
E/AndroidRuntime(29268):    at com.google.mlkit.vision.common.InputImage.zzb(com.google.mlkit:vision-common@@17.1.0:1)
E/AndroidRuntime(29268):    at com.google.mlkit.vision.common.InputImage.zza(com.google.mlkit:vision-common@@17.1.0:19)
E/AndroidRuntime(29268):    at com.google.mlkit.vision.common.InputImage.fromMediaImage(com.google.mlkit:vision-common@@17.1.0:1)
E/AndroidRuntime(29268):    at yy.JXG.analyze(yy.JXG:21)
E/AndroidRuntime(29268):    at yy.HXG.analyze(yy.HXG:203)
E/AndroidRuntime(29268):    at yy.fEG.uG(yy.fEG:224)
E/AndroidRuntime(29268):    at yy.fEG.xG(Unknown Source:0)
E/AndroidRuntime(29268):    at yy.ZcG.analyze(Unknown Source:2)
E/AndroidRuntime(29268):    at androidx.camera.core.ImageAnalysis.lambda$setAnalyzer$1$ImageAnalysis(ImageAnalysis.java:367)
E/AndroidRuntime(29268):    at androidx.camera.core.ImageAnalysis$$ExternalSyntheticLambda0.analyze(Unknown Source:4)
E/AndroidRuntime(29268):    at androidx.camera.core.ImageAnalysisAbstractAnalyzer.lambda$analyzeImage$0$ImageAnalysisAbstractAnalyzer(ImageAnalysisAbstractAnalyzer.java:121)
E/AndroidRuntime(29268):    at androidx.camera.core.ImageAnalysisAbstractAnalyzer$$ExternalSyntheticLambda1.run(Unknown Source:8)
E/AndroidRuntime(29268):    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
E/AndroidRuntime(29268):    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
E/AndroidRuntime(29268):    at java.lang.Thread.run(Thread.java:919)
(...)
I/RequestQueue(29268): Repeating capture request cancelled.
I/RequestQueue(29268): Repeating capture request set.
W/LegacyRequestMapper(29268): convertRequestMetadata - control.awbRegions setting is not supported, ignoring value
W/LegacyRequestMapper(29268): Only received metering rectangles with weight 0.
W/LegacyRequestMapper(29268): Only received metering rectangles with weight 0.
ArchangeGabriel commented 1 year ago

Related: https://github.com/microg/GmsCore/issues/1742

paolo-caroni commented 1 year ago

I think MLKit has not (yet?) been implemented in microg.

It seems that is supported old Mobile Vision API only (and only for barcode), also would be a good idea support tensorflow on microg, MLkit is strongly based on tensorflow and gms offer tensorflow API for app that need it. But honestly this is the game of the mouse and the cat, google deprecate API very fast and replace it in time seems VERY difficult for a FOSS project.