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.54k stars 2.92k forks source link

Unable to get provider com.google.mlkit.common.internal.MlKitInitProvider #277

Open rohitramkumar308 opened 3 years ago

rohitramkumar308 commented 3 years ago

We recently migrated from firebase-ml-vision -> mlkit:barcode-scanning and have started to see crashes on few devices. We do not use Dynamic modules.

Devices moto e6 Andoird 9 Galaxy S9+ Android 10

Dependency com.google.mlkit:barcode-scanning:16.1.1

Stacktrace

Fatal Exception: java.lang.RuntimeException: Unable to get provider com.google.mlkit.common.internal.MlKitInitProvider: java.lang.ClassNotFoundException: Didn't find class "com.google.mlkit.common.internal.MlKitInitProvider" on path: DexPathList[ ... ]
       at android.app.ActivityThread.installProvider(ActivityThread.java:6659)
       at android.app.ActivityThread.installContentProviders(ActivityThread.java:6201)
       at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6109)
       at android.app.ActivityThread.access$1200(ActivityThread.java:213)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1816)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:215)
       at android.app.ActivityThread.main(ActivityThread.java:6939)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:870)
Caused by java.lang.ClassNotFoundException: Didn't find class "com.google.mlkit.common.internal.MlKitInitProvider" on path: DexPathList[ ... ]
       at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
       at android.app.AppComponentFactory.instantiateProvider(AppComponentFactory.java:121)
       at androidx.core.app.CoreComponentFactory.instantiateProvider(CoreComponentFactory.java:67)
       at android.app.ActivityThread.installProvider(ActivityThread.java:6643)
       at android.app.ActivityThread.installContentProviders(ActivityThread.java:6201)
       at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6109)
       at android.app.ActivityThread.access$1200(ActivityThread.java:213)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1816)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:215)
       at android.app.ActivityThread.main(ActivityThread.java:6939)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:870)
Derpimort commented 3 years ago

IDK if it helps but I recently had the same issue and the only changes were updating the room deps from 2.2.6 to 2.3.0. So I reverted them back and it worked :/

leiiiooo commented 3 years ago

why this issue closed

hamberluo commented 3 years ago

same issue

Eric-Cen commented 3 years ago

To fix this issue with dynamic feature modules, add implementation 'com.google.mlkit:barcode-scanning:16.2.0' to both build.gralde files in feature module and the base app module

cs-googler commented 3 years ago

To

To fix this issue with dynamic feature modules, add implementation 'com.google.mlkit:barcode-scanning:16.2.0' to both build.gralde files in feature module and the base app module

If you are using ML Kit features in a dynamic feature module, please follow this guide to add com.google.mlkit:playstore-dynamic-feature-support:16.0.0-beta1 into your app's base module's gradle file and add the feature's sdk dependency into the feature module's dependency.

Eric-Cen commented 3 years ago

To

To fix this issue with dynamic feature modules, add implementation 'com.google.mlkit:barcode-scanning:16.2.0' to both build.gralde files in feature module and the base app module

If you are using ML Kit features in a dynamic feature module, please follow this guide to add com.google.mlkit:playstore-dynamic-feature-support:16.0.0-beta1 into your app's base module's gradle file and add the feature's sdk dependency into the feature module's dependency.

I added the followings based on the provided link: implementation 'com.google.mlkit:playstore-dynamic-feature-support:16.0.0-beta1' // => in base model

implementation "com.google.mlkit:barcode-scanning:16.2.0" // => in dynamic feature module

Error msg: java.lang.RuntimeException: Unable to get provider com.google.mlkit.common.internal.MlKitInitProvider: com.google.firebase.components.MissingDependencyException: Unsatisfied dependency for component Component<[class com.google.mlkit.vision.barcode.internal.zze]>{0, type=0, deps=[Dependency{anInterface=class com.google.mlkit.common.sdkinternal.ExecutorSelector, type=required, injection=direct}, Dependency{anInterface=class com.google.mlkit.vision.barcode.internal.zzf, type=required, injection=direct}]}: class com.google.mlkit.common.sdkinternal.ExecutorSelector

Any suggestion?

AndresGarciaSobrado91 commented 3 years ago

To

To fix this issue with dynamic feature modules, add implementation 'com.google.mlkit:barcode-scanning:16.2.0' to both build.gralde files in feature module and the base app module

If you are using ML Kit features in a dynamic feature module, please follow this guide to add com.google.mlkit:playstore-dynamic-feature-support:16.0.0-beta1 into your app's base module's gradle file and add the feature's sdk dependency into the feature module's dependency.

I added the followings based on the provided link: implementation 'com.google.mlkit:playstore-dynamic-feature-support:16.0.0-beta1' // => in base model

implementation "com.google.mlkit:barcode-scanning:16.2.0" // => in dynamic feature module

Error msg: java.lang.RuntimeException: Unable to get provider com.google.mlkit.common.internal.MlKitInitProvider: com.google.firebase.components.MissingDependencyException: Unsatisfied dependency for component Component<[class com.google.mlkit.vision.barcode.internal.zze]>{0, type=0, deps=[Dependency{anInterface=class com.google.mlkit.common.sdkinternal.ExecutorSelector, type=required, injection=direct}, Dependency{anInterface=class com.google.mlkit.vision.barcode.internal.zzf, type=required, injection=direct}]}: class com.google.mlkit.common.sdkinternal.ExecutorSelector

Any suggestion?

same here..

AxonDragonScale commented 3 years ago

To

To fix this issue with dynamic feature modules, add implementation 'com.google.mlkit:barcode-scanning:16.2.0' to both build.gralde files in feature module and the base app module

If you are using ML Kit features in a dynamic feature module, please follow this guide to add com.google.mlkit:playstore-dynamic-feature-support:16.0.0-beta1 into your app's base module's gradle file and add the feature's sdk dependency into the feature module's dependency.

After adding this dependency, the release builds work fine, but getting the below on debug build

    java.lang.RuntimeException: Unable to get provider com.google.mlkit.common.internal.MlKitInitProvider: com.google.firebase.components.MissingDependencyException: Unsatisfied dependency for component Component<[class com.google.mlkit.vision.barcode.internal.zze]>{0, type=0, deps=[Dependency{anInterface=class com.google.mlkit.vision.barcode.internal.zzf, type=required, injection=direct}, Dependency{anInterface=class com.google.mlkit.common.sdkinternal.ExecutorSelector, type=required, injection=direct}]}: class com.google.mlkit.common.sdkinternal.ExecutorSelector
        at android.app.ActivityThread.installProvider(ActivityThread.java:6489)
        at android.app.ActivityThread.installContentProviders(ActivityThread.java:5982)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5888)
        at android.app.ActivityThread.access$1100(ActivityThread.java:200)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1660)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:6762)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
     Caused by: com.google.firebase.components.MissingDependencyException: Unsatisfied dependency for component Component<[class com.google.mlkit.vision.barcode.internal.zze]>{0, type=0, deps=[Dependency{anInterface=class com.google.mlkit.vision.barcode.internal.zzf, type=required, injection=direct}, Dependency{anInterface=class com.google.mlkit.common.sdkinternal.ExecutorSelector, type=required, injection=direct}]}: class com.google.mlkit.common.sdkinternal.ExecutorSelector
        at com.google.firebase.components.ComponentRuntime.processDependencies(ComponentRuntime.java:324)
        at com.google.firebase.components.ComponentRuntime.discoverComponents(ComponentRuntime.java:139)
        at com.google.firebase.components.ComponentRuntime.<init>(ComponentRuntime.java:91)
        at com.google.firebase.components.ComponentRuntime.<init>(ComponentRuntime.java:45)
        at com.google.firebase.components.ComponentRuntime$Builder.build(ComponentRuntime.java:360)
        at com.google.mlkit.common.sdkinternal.MlKitContext.zza(com.google.mlkit:common@@17.2.0:9)
        at com.google.mlkit.common.internal.MlKitInitProvider.onCreate(com.google.mlkit:common@@17.2.0:3)
        at android.content.ContentProvider.attachInfo(ContentProvider.java:1919)
        at android.content.ContentProvider.attachInfo(ContentProvider.java:1894)
        at com.google.mlkit.common.internal.MlKitInitProvider.attachInfo(com.google.mlkit:common@@17.2.0:3)
        at android.app.ActivityThread.installProvider(ActivityThread.java:6484)
        at android.app.ActivityThread.installContentProviders(ActivityThread.java:5982) 
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5888) 
        at android.app.ActivityThread.access$1100(ActivityThread.java:200) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1660) 
        at android.os.Handler.dispatchMessage(Handler.java:106) 
        at android.os.Looper.loop(Looper.java:193) 
        at android.app.ActivityThread.main(ActivityThread.java:6762) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858) 
sukanzubair commented 2 years ago

Hi, I am experiencing a similar issue and had to turn of the code shrinker to get this to work.

image

akshatIndmoney commented 1 year ago

We am also getting similar kind of crash in our application. We have multi module application but no dynamic module

dependency used com.google.android.gms:play-services-mlkit-face-detection:17.1.0

Affected Devices: Oppo A5 android 8.1.0, Oneplus 6T android 9, Xiaomi M2006C3LII android 10, Realme 3i android 10, Samsung Galaxy Note 9 android 10

PFA stack trace

Fatal Exception: java.lang.RuntimeException: Unable to get provider com.google.mlkit.common.internal.MlKitInitProvider: java.lang.ClassNotFoundException: Didn't find class "com.google.mlkit.common.internal.MlKitInitProvider" on path: DexPathList[[zip file "/data/app/in.indwealth-RDrT6rNp0tfrVeUiHwF8Bg==/base.apk", zip file "/data/app/in.indwealth-RDrT6rNp0tfrVeUiHwF8Bg==/split_config.arm64_v8a.apk", zip file "/data/app/in.indwealth-RDrT6rNp0tfrVeUiHwF8Bg==/split_config.xxhdpi.apk"],nativeLibraryDirectories=[/data/app/in.indwealth-RDrT6rNp0tfrVeUiHwF8Bg==/lib/arm64, /data/app/in.indwealth-RDrT6rNp0tfrVeUiHwF8Bg==/base.apk!/lib/arm64-v8a, /data/app/in.indwealth-RDrT6rNp0tfrVeUiHwF8Bg==/split_config.arm64_v8a.apk!/lib/arm64-v8a, /data/app/in.indwealth-RDrT6rNp0tfrVeUiHwF8Bg==/split_config.xxhdpi.apk!/lib/arm64-v8a, /system/lib64]] at android.app.ActivityThread.installProvider(ActivityThread.java:7769) at android.app.ActivityThread.installContentProviders(ActivityThread.java:7309) at android.app.ActivityThread.handleMakeApplication(ActivityThread.java:7166) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7134) at android.app.ActivityThread.access$1600(ActivityThread.java:274) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2102) at android.os.Handler.dispatchMessage(Handler.java:107) at android.os.Looper.loop(Looper.java:237) at android.app.ActivityThread.main(ActivityThread.java:8167) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:496) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1100)