googlesamples / googlesamples/mlkit

[Bug report] BarcodeScanning getClient - MlKitContext has not been initialized

Open
#644 3 comments 1 reaction 1 assignee Claimed by @zhouyiself View on GitHub
Dominant language
Kotlin
Stars
4.3k
Forks
3.1k
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**
A clear and concise description of what the bug is.
We started seeing this rarely on some devices at the moment.
It is weird that getting `MlKitContext has not been initialized` even though we are not manually initializing a context (neither disabled content-provider as well)

If applicable, please include `code snippet` and `sample input(image, video, text, etc)`

```
java.lang.IllegalStateException: MlKitContext has not been initialized
at com.google.android.gms.common.internal.Preconditions.checkState(com.google.android.gms:play-services-basement@@18.1.0:0)
at com.google.mlkit.common.sdkinternal.MlKitContext.getInstance(com.google.mlkit:common@@18.5.0:13)
at com.google.mlkit.vision.barcode.BarcodeScanning.getClient(com.google.android.gms:play-services-mlkit-barcode-scanning@@16.2.1:3)
```

**Expected behavior**
A clear and concise description of what you expected to happen.

**SDK Info:**
- SDK Name & Version `com.google.mlkit:barcode-scanning:17.0.0`

**Smartphone:**
- Device Armor 11 5G

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.