14

[mlkit]

I am implementing the "On-device text recognition" from the Google Machine Learning Kit for android. I followed this guide but every time try to detect text I get the exception "Waiting for the text recognition model to be downloaded. Please wait."

Obviously, waiting doesn't help, neither does making a new detection 10 seconds later.

I have the meta tag

<meta-data
    android:name="com.google.firebase.ml.vision.DEPENDENCIES"
    android:value="text" />

in my manifest's app tag, which is supposed to pre-download the recognition model upon app installation.

Edit: I just tried the sample app(text-recognition/final) and it has the exact same issue.

Am I missing something or is there a bug with the API? Any help would be appreciated.

Frank van Puffelen
  • 418,229
  • 62
  • 649
  • 645
M.Paunov
  • 977
  • 9
  • 14
  • This is very bizarre, there is no mention of such bug in the firebase google groups nor in the slack group. THe codelabs don't use the meta-data tag, maybe try without it just to see waht happens? And there's only one question on SO with the same problem https://stackoverflow.com/questions/50327229/google-machine-learning-kit-recognize-text-in-images-with-ml-kit-on-android-err – Levi Moreira May 14 '18 at 14:09
  • I was surprised also. I tried to remove the meta-tag and there was no difference - the same exception. – M.Paunov May 14 '18 at 14:12
  • 1
    I've just tested in my phone and worked perfectly, both with and without the tag. Tested also in the emulator and worked normally, my phone is android o and the emulator android N. Can you tell me what phone are you using? Android version? – Levi Moreira May 14 '18 at 14:19
  • I am using Huawei P10 with Android 7.0 – M.Paunov May 14 '18 at 14:41
  • 1
    can you try the code in the emulator? so we can see if the problem is the device – Levi Moreira May 14 '18 at 14:48
  • 1
    I just run it on Samsung S5 with android 6 and it works like charm. I am now on a mission to see if the problem is with the device or OS. – M.Paunov May 14 '18 at 14:50
  • I'll try to figure it out with the other question if they're using the same device, but it looks like a deice specific problem – Levi Moreira May 14 '18 at 14:55
  • Do you have access to the exception thrown? Can you run getCode on it? – Levi Moreira May 14 '18 at 15:13
  • I can confirm that it is device specific, because it is now tested on other devices with android 7. I still don't know if it is a setting on that device or something else. Thanks for your help! Edit: yes, e.getCode() returns: result = 14 – M.Paunov May 14 '18 at 15:14

3 Answers3

6

After further investigation, we found that the problem occurs only on a specific device and it coincided with other ad mob anomalies. I tried the following and it works:

Settings->Apps->Google Play Services->Storage->Manage Space->Clear All Data

The first request after that still returned the same error as before, but the second request succeeded.

ColdFire
  • 6,116
  • 6
  • 32
  • 50
M.Paunov
  • 977
  • 9
  • 14
6

Agree with the answer above that this can happen if the storage on the device is not sufficient or say the internet is not available at all (which seems unlikely given the question). This is a one-time issue faced during development (unless the app cache is cleared).

Just want to add an answer on the manifest meta-tag part. The tag in the manifest avoids this problem in production by pre-downloading the recognition model upon app installation from Play Store:

<meta-data
    android:name="com.google.firebase.ml.vision.DEPENDENCIES"
    android:value="ocr" />
Isabella Chen
  • 2,343
  • 11
  • 24
Pannag Sanketi
  • 1,314
  • 1
  • 7
  • 9
-1

I had same error "Waiting for the text recognition model to be downloaded" in my mobile, I just updated all my other apps in playstore, then it started working, try it :)

again after few months I had same error, then previous guy's suggestion helped

"Settings->Apps->Google Play Store->Storage->Manage Space->Clear All Data

The first request after that still returned the same error as before, but the second request succeeded.""

cleared all data of Google play store as well as the app in which I was getting this error "Waiting for the text recognition model to be downloaded", it worked