googlesamples / mlkit

A collection of sample apps to demonstrate how to use Google's ML Kit APIs on Android and iOS
Apache License 2.0
3.45k stars 2.89k forks source link

[Bug report] MlKit Translate - IllegalStateException #664

Open HaydenCampbell opened 1 year ago

HaydenCampbell commented 1 year ago

Describe the bug I'm seeing this error appear in my Crash logs in the Google Play Console. I haven't been able to reproduce it yet, and I'm not sure which Language model they are selecting when the error appears. It's only affecting 0.03% of the total users of my app.

Exception java.lang.IllegalStateException:
  at com.google.mlkit.nl.translate.internal.zzi.zzb (com.google.mlkit:translate@@17.0.1:66)
  at com.google.mlkit.nl.translate.internal.zzi.zzg (com.google.mlkit:translate@@17.0.1:4)
  at com.google.mlkit.nl.translate.internal.zzf.run (com.google.mlkit:translate@@17.0.1)
  at android.os.Handler.handleCallback (Handler.java:938)
  at android.os.Handler.dispatchMessage (Handler.java:99)
  at android.os.Looper.loop (Looper.java:263)
  at android.os.HandlerThread.run (HandlerThread.java:67)

To Reproduce I haven't been able to reproduce it yet. I'm receiving the error in Crashes and ANRs logs inside Google Play Console. My code is pretty much identical to the the sample app

Expected behavior No error

SDK Info: com.google.mlkit:translate:17.0.1

Smartphone:

HaydenCampbell commented 1 year ago

Received what looks like the same error, this time in the Pre-launch report in Google Play Console:

Exception java.lang.IllegalStateException: Failed to create directory within 10000 attempts (tried 1684399956231-0 to 1684399956231-9999)
  at com.google.mlkit.nl.translate.internal.zzi.zzb (com.google.mlkit:translate@@17.0.1:66)
  at com.google.mlkit.nl.translate.internal.zzi.zzg (com.google.mlkit:translate@@17.0.1:4)
  at com.google.mlkit.nl.translate.internal.zzf.run (zzf.java:18)
  at android.os.Handler.handleCallback (Handler.java:873)
  at android.os.Handler.dispatchMessage (Handler.java:99)
  at android.os.Looper.loop (Looper.java:193)
  at android.os.HandlerThread.run (HandlerThread.java:65)

Model name: Pixel 2 (virtual) Manufacturer: Google Android version: Android 9 (SDK 28) Locale: en_AU ABI: x86

I still haven't been able to replicate this myself though.

HaydenCampbell commented 10 months ago

Still seeing this one in my crashlytics, would be nice to have it looked at as it's affecting quite a few users.

Screenshot 2023-09-04 at 4 58 58 pm
marchenko-ay commented 1 month ago

The error still occurs on the current version of the library com.google.mlkit:translate:17.0.2, our QA-engineer found it on a couple of devices (Samsung SM-A500F and Xiaomi Redmi Note 8T), on the rest it was not observed, and on all devices downloaded the same set of models for translation. The error is the same:

2024-06-04 20:19:02.659 19139-19194/xxx.xxxxxxxx.xxxxxx E/AndroidRuntime: FATAL EXCEPTION: MLHandler
    Process: xxx.xxxxxxxx.xxxxxx, PID: 19139
    java.lang.IllegalStateException: Failed to create directory within 10000 attempts (tried 1717521541522-0 to 1717521541522-9999)
        at com.google.android.gms.internal.mlkit_translate.zzbc.zza(com.google.mlkit:translate@@17.0.2:5)
        at com.google.android.gms.internal.mlkit_translate.zzba.zza(com.google.mlkit:translate@@17.0.2:1)
        at com.google.mlkit.nl.translate.internal.zzi.zzb(com.google.mlkit:translate@@17.0.2:26)
        at com.google.mlkit.nl.translate.internal.zzi.zzg(com.google.mlkit:translate@@17.0.2:4)
        at com.google.mlkit.nl.translate.internal.zzf.run(com.google.mlkit:translate@@17.0.2)
        at android.os.Handler.handleCallback(Handler.java:739)
        at android.os.Handler.dispatchMessage(Handler.java:95)
        at android.os.Looper.loop(Looper.java:148)
        at android.os.HandlerThread.run(HandlerThread.java:61)