mlkit
mlkit copied to clipboard
[Bug report] Attempting to initialize TextRecognition on Android on a separate process crashes.
Describe the bug Running an Android service that attempts to use the TextRecognition API crashes when trying to initialize the client. This happens when the service is running on a different process than the main application, but doesn't happen when the app is run as single process.
To Reproduce
- Create an app with a service running TextRecognition.
- In the manifest, set that service to a different process than the rest of the application.
- Run the app to hit the line of code
TextRecognition.getClient(TextRecognizerOptions.DEFAULT_OPTIONS)
When catching the exception to output, I get the following stack trace:
com.google.android.gms.common.internal.Preconditions.checkState(com.google.android.gms:play-services-basement@@18.0.0:2)
com.google.mlkit.common.sdkinternal.MlKitContext.getInstance(com.google.mlkit:common@@18.0.0:1)
com.google.mlkit.vision.text.TextRecognition.getClient(com.google.android.gms:play-services-mlkit-text-recognition-common@@17.0.0:1)
...
Expected behavior TextRecognition client to be initialized.
SDK Info:
- 'com.google.mlkit:text-recognition:16.0.0-beta3'
Also fails with text recognition v1 (18.0.0)
Smartphone:
- Device/Simulator: Samsung Galaxy S10 & Pixel 6
- Device/Simulator OS: Android 11 and Android 12