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.6k stars 2.94k forks source link

[Bug report] Android crash on app start at CommonComponentRegistrar.getComponents #862

Open fanwgwg opened 3 months ago

fanwgwg commented 3 months ago

Describe the bug On Firebase crashlytics, we're seeing some crashes upon app start for "Google Cros" device only (I think it's a ChromeOS device).

To Reproduce Here's the detailed stacktrace:

  Fatal Exception: java.lang.ExceptionInInitializerError:
       at com.google.android.gms.internal.mlkit_common.zzaq.zzg(com.google.mlkit:common@@18.10.0:2)
       at com.google.android.gms.internal.mlkit_common.zzaq.zzi(com.google.mlkit:common@@18.10.0:2)
       at com.google.mlkit.common.internal.CommonComponentRegistrar.getComponents(com.google.mlkit:common@@18.10.0:1)
       at com.google.firebase.components.ComponentRuntime.discoverComponents(ComponentRuntime.java:118)
       at com.google.firebase.components.ComponentRuntime.<init>(ComponentRuntime.java:100)
       at com.google.firebase.components.ComponentRuntime.<init>(ComponentRuntime.java:46)
       at com.google.firebase.components.ComponentRuntime$Builder.build(ComponentRuntime.java:407)
       at com.google.mlkit.common.sdkinternal.MlKitContext.zza(MlKitContext.java:10)
       at com.google.mlkit.common.internal.MlKitInitProvider.onCreate(com.google.mlkit:common@@18.10.0:3)
       at android.content.ContentProvider.attachInfo(ContentProvider.java:2388)
       at android.content.ContentProvider.attachInfo(ContentProvider.java:2358)
       at com.google.mlkit.common.internal.MlKitInitProvider.attachInfo(com.google.mlkit:common@@18.10.0:3)
       at android.app.ActivityThread.installProvider(ActivityThread.java:7268)
       at android.app.ActivityThread.installContentProviders(ActivityThread.java:6809)
       at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6726)
       at android.app.ActivityThread.access$1400(ActivityThread.java:237)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1924)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:223)
       at android.app.ActivityThread.main(ActivityThread.java:7741)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:966)

   Caused by java.lang.NullPointerException: Attempt to invoke virtual method 'int java.util.AbstractCollection.size()' on a null object reference
       at com.google.android.gms.internal.mlkit_common.zzao.<init>(com.google.mlkit:common@@18.10.0)
       at com.google.android.gms.internal.mlkit_common.zzaq.<clinit>(com.google.mlkit:common@@18.10.0:1)
       at com.google.android.gms.internal.mlkit_common.zzaq.zzg(com.google.mlkit:common@@18.10.0:2)
       at com.google.android.gms.internal.mlkit_common.zzaq.zzi(com.google.mlkit:common@@18.10.0:2)
       at com.google.mlkit.common.internal.CommonComponentRegistrar.getComponents(com.google.mlkit:common@@18.10.0:1)
       at com.google.firebase.components.ComponentRuntime.discoverComponents(ComponentRuntime.java:118)
       at com.google.firebase.components.ComponentRuntime.<init>(ComponentRuntime.java:100)
       at com.google.firebase.components.ComponentRuntime.<init>(ComponentRuntime.java:46)
       at com.google.firebase.components.ComponentRuntime$Builder.build(ComponentRuntime.java:407)
       at com.google.mlkit.common.sdkinternal.MlKitContext.zza(MlKitContext.java:10)
       at com.google.mlkit.common.internal.MlKitInitProvider.onCreate(com.google.mlkit:common@@18.10.0:3)
       at android.content.ContentProvider.attachInfo(ContentProvider.java:2388)
       at android.content.ContentProvider.attachInfo(ContentProvider.java:2358)
       at com.google.mlkit.common.internal.MlKitInitProvider.attachInfo(com.google.mlkit:common@@18.10.0:3)
       at android.app.ActivityThread.installProvider(ActivityThread.java:7268)
       at android.app.ActivityThread.installContentProviders(ActivityThread.java:6809)
       at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6726)
       at android.app.ActivityThread.access$1400(ActivityThread.java:237)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1924)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:223)
       at android.app.ActivityThread.main(ActivityThread.java:7741)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:966)

image

Expected behavior There shouldn't be crash upon app open

SDK Info: implementation 'com.google.mlkit:digital-ink-recognition:18.1.0' implementation 'com.google.android.gms:play-services-mlkit-subject-segmentation:16.0.0-beta1' implementation 'com.google.android.gms:play-services-mlkit-document-scanner:16.0.0-beta1'

Smartphone: Google Cros Android 11