androidgoogle-play-servicesgoogle-mlkittext-recognition

Android ML Kit: TextRecognizer without Google Play Services


I've got a requirement to utilize Text Recognition services on an offline Android device without Google Play Services. I had been following this guide from Google on how to get it working.

However, you will notice that the application will either:

  1. Download the models when downloaded from the Google Play Store, OR
  2. Download the models on first use

Obviously, neither of these fit my usecase. I had attempted to package the models with the APK inside assets and then extract them to the cache manually. The extraction of course worked, but my text recognition does still not work because it cannot communicate with Google Play Services:

E/DynamiteModule: Failed to load IDynamiteLoader from GmsCore: Application package com.google.android.gms not found

Is there any way around this, even a hacky way? Do I really need to utilize another text recognition software, or make my own weights to use?

Thanks in advance.


Solution

  • Yes you are right, with text v1 it is required to download the model additionally. Do you mind use text v2 which is in beta version at https://developers.google.com/ml-kit/vision/text-recognition/v2/android which:

    1. is a bundled version so you dont need to download model.
    2. support more languages other than latin, but of course if your usage is just English(or latin), com.google.mlkit:text-recognition is enough.