2

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?

user3429953
  • 352
  • 3
  • 19
  • find any solution? – Bhavin Patel Feb 22 '20 at 10:22
  • I have this problem with some other device also do you find any solution so far? – Hadi Ahmadi May 01 '20 at 04:22
  • Sorry, @bdevloper and Hadi. What I found was that if the mobile phone has not the Google Play Services pre-installed and you install them from another market, it automatically updates them to the latest version and this causes some strange behaviour like this one. For me, the "solution" was uninstall completely the Google Play Services, install them again and not update them anymore. – user3429953 Jun 05 '20 at 10:06
  • can't tell this to user to uninstall playservices – Bhavin Patel Jun 06 '20 at 05:31
  • Yeah, that's why I said "solution" and why this answer is still open. – user3429953 Jun 07 '20 at 14:25

0 Answers0