I have developed an Android Application that uses Firebase MLKit Text Recognition API (on device) to detect texts on images. It works successfully on all tested devices but on a Xiaomi Mi 8 (Android 9, MIUI 11.0.3) it is not able to never download the ML model so it always give an FirebaseMLException with code 14 (UNAVAILABLE) - Waiting for the model to be downloaded.
This is my code:
try {
val imageBitmap = imagePath.getBitmapFromFilePath()
val image = FirebaseVisionImage.fromBitmap(imageBitmap)
val detector = FirebaseVision.getInstance().onDeviceTextRecognizer
detector.processImage(image)
.addOnSuccessListener { firebaseVisionText ->
onSuccess.invoke(textBlocksMapper.map(firebaseVisionText.textBlocks))
}
.addOnFailureListener { e ->
e.printStackTrace()
onError.invoke()
}
} catch (e: IOException) {
e.printStackTrace()
onError.invoke()
}
And the error on that specific device is:
2019-10-29 12:07:28.683 4040-4217 E/Vision: Error loading module com.google.android.gms.vision.ocr optional module true: kw: No acceptable module found. Local version is 0 and remote version is 0.
2019-10-29 12:07:28.714 4040-4217 I/Vision: libocr.so library load status: false
2019-10-29 12:07:28.715 4040-4217 I/Vision: Request download for engine ocr is a no-op because rate limiting
2019-10-29 12:07:28.719 4040-4040 W/System.err: com.google.firebase.ml.common.FirebaseMLException: Waiting for the text recognition model to be downloaded. Please wait.
I have already tried to: 1. Clear cache and data of Google Play Services 2. Remove and grant camera permissions 3. Add meta-data tag for firebase ml ocr and text 4. Reboot
... but the error continues.
May it be that the Xiaomi SO is blocking the model download? Am I missing something?