Describe the bug
Hello, when you call isModelDownloaded method on RemoteModelManager instance having a TranslateRemoteModel parameter with unexpected model name, you get the following error:
com.google.android.gms.tasks.RuntimeExecutionException: java.lang.IllegalArgumentException: Model name expected to be matching [a-z]{2,3}_[a-z]{2,3}
at com.google.android.gms.tasks.zzw.getResult(com.google.android.gms:play-services-tasks@@18.0.2:3)
at com.google.mlkit.nl.translate.internal.zzan.zzf(com.google.mlkit:translate@@17.0.1:1)
at com.google.mlkit.nl.translate.internal.zzam.onComplete(Unknown Source:2)
at com.google.android.gms.tasks.zzi.run(com.google.android.gms:play-services-tasks@@18.0.2:1)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7839)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
Caused by: java.lang.IllegalArgumentException: Model name expected to be matching [a-z]{2,3}_[a-z]{2,3}
at com.google.mlkit.nl.translate.internal.zzad.zzg(com.google.mlkit:translate@@17.0.1:2)
at com.google.mlkit.nl.translate.internal.zzad.zza(com.google.mlkit:translate@@17.0.1:1)
at com.google.mlkit.nl.translate.internal.zzi.zzj(com.google.mlkit:translate@@17.0.1:4)
at com.google.mlkit.nl.translate.internal.zzac.zzf(com.google.mlkit:translate@@17.0.1:1)
at com.google.mlkit.nl.translate.internal.zzan.zzc(com.google.mlkit:translate@@17.0.1:1)
at com.google.mlkit.nl.translate.internal.zzal.then(Unknown Source:4)
at com.google.android.gms.tasks.zzc.run(com.google.android.gms:play-services-tasks@@18.0.2:3)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.os.HandlerThread.run(HandlerThread.java:67)
To Reproduce
Identify language of a text using the following code, which can return "ar-Latn" on its onSuccess callback:
Try to call isModelDownloaded method on RemoteModelManager instance having a TranslateRemoteModel parameter created with the "ar-Latn" language from the previous step:
import com.google.mlkit.common.model.RemoteModelManager
import com.google.mlkit.nl.translate.TranslateRemoteModel
...
val modelManager = RemoteModelManager.getInstance()
val translateRemoteModel = TranslateRemoteModel.Builder("ar-Latn").build()
modelManager.isModelDownloaded(translateRemoteModel) // >>> This is where the crash happens inside mlkit library
Application crashes
Expected behavior
A clear and concise description of what you expected to happen.
SDK Info:
Still exist in the latest versions of these libraries but the one I had used are the following:
com.google.mlkit:language-id:17.0.4
com.google.mlkit:translate:17.0.1
Smartphone:
Might not be device/OS specific, but I can repeatedly reproduce this issue on the following simulator:
Describe the bug Hello, when you call
isModelDownloaded
method onRemoteModelManager
instance having aTranslateRemoteModel
parameter with unexpected model name, you get the following error:To Reproduce
"ar-Latn"
on its onSuccess callback:isModelDownloaded
method onRemoteModelManager
instance having aTranslateRemoteModel
parameter created with the"ar-Latn"
language from the previous step:Expected behavior A clear and concise description of what you expected to happen.
SDK Info: Still exist in the latest versions of these libraries but the one I had used are the following:
Smartphone: Might not be device/OS specific, but I can repeatedly reproduce this issue on the following simulator: