I have a project which uses firebase database,auth and other dependencies but whenever i try to add firebase ml vision or google play service vision dependencie the app crashes although gradle build was successful.
edit : thats what logcat look like
06-27 02:36:37.757 17719-17719/com.example.nikhiljindal.testing_start I/zygote: at com.google.firebase.FirebaseApp com.google.firebase.FirebaseApp.initializeApp(android.content.Context) (SourceFile:281)
at boolean com.google.firebase.provider.FirebaseInitProvider.onCreate() (SourceFile:37)
at void android.content.ContentProvider.attachInfo(android.content.Context, android.content.pm.ProviderInfo, boolean) (ContentProvider.java:1917)
at void android.content.ContentProvider.attachInfo(android.content.Context, android.content.pm.ProviderInfo) (ContentProvider.java:1892)
at void com.google.firebase.provider.FirebaseInitProvider.attachInfo(android.content.Context, android.content.pm.ProviderInfo) (SourceFile:31)
06-27 02:36:37.758 17719-17719/com.example.nikhiljindal.testing_start I/zygote: at android.app.ContentProviderHolder android.app.ActivityThread.installProvider(android.content.Context, android.app.ContentProviderHolder, android.content.pm.ProviderInfo, boolean, boolean, boolean) (ActivityThread.java:6239)
at void android.app.ActivityThread.installContentProviders(android.content.Context, java.util.List) (ActivityThread.java:5805)
at void android.app.ActivityThread.handleBindApplication(android.app.ActivityThread$AppBindData) (ActivityThread.java:5722)
at void android.app.ActivityThread.-wrap1(android.app.ActivityThread, android.app.ActivityThread$AppBindData) (ActivityThread.java:-1)
at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1656)
at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:106)
at void android.os.Looper.loop() (Looper.java:164)
at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6494)
at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:-2)
at void com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run() (RuntimeInit.java:438)
at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:807)
**Caused by: java.lang.ClassNotFoundException: Didn't find class** "com.google.android.gms.internal.zzfjm" on path: DexPathList[[zip file "/data/app/com.example.nikhiljindal.testing_start-qaVCC6CsVTDhpZWzHSJoXg==/base.apk", zip file "/data/app/com.example.nikhiljindal.testing_start-qaVCC6CsVTDhpZWzHSJoXg==/split_lib_dependencies_apk.apk", zip file "/data/app/com.example.nikhiljindal.testing_start-qaVCC6CsVTDhpZWzHSJoXg==/split_lib_resources_apk.apk", zip file "/data/app/com.example.nikhiljindal.testing_start-qaVCC6CsVTDhpZWzHSJoXg==/split_lib_slice_0_apk.apk", zip file "/data/app/com.example.nikhiljindal.testing_start-qaVCC6CsVTDhpZWzHSJoXg==/split_lib_slice_1_apk.apk", zip file "/data/app/com.example.nikhiljindal.testing_start-qaVCC6CsVTDhpZWzHSJoXg==/split_lib_slice_2_apk.apk", zip file "/data/app/com.example.nikhiljindal.testing_start-qaVCC6CsVTDhpZWzHSJoXg==/split_lib_slice_3_apk.apk", zip file "/data/app/com.example.nikhiljindal.testing_start-qaVCC6CsVTDhpZWzHSJoXg==/split_lib_slice_4_apk.apk", zip file "/d
at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:125)
at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:379)
at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
at com.google.android.gms.internal.zzcim com.google.android.gms.internal.zzcim.zzdx(android.content.Context) ((null):-1)
at com.google.android.gms.measurement.AppMeasurement com.google.android.gms.measurement.AppMeasurement.getInstance(android.content.Context) ((null):-1)
at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:-2)
at void com.google.firebase.FirebaseApp.zza(java.lang.Class, java.lang.Object, java.lang.Iterable, boolean) (SourceFile:739)
at void com.google.firebase.FirebaseApp.zze() (SourceFile:709)
at com.google.firebase.FirebaseApp com.google.firebase.FirebaseApp.initializeApp(android.content.Context, com.google.firebase.FirebaseOptions, java.lang.String) (SourceFile:328)
at com.google.firebase.FirebaseApp com.google.firebase.FirebaseApp.initializeApp(android.content.Context, com.google.firebase.FirebaseOptions) (SourceFile:294)
at com.google.firebase.FirebaseApp com.google.firebase.FirebaseApp.initializeApp(android.content.Context) (SourceFile:281)
at boolean com.google.firebase.provider.FirebaseInitProvider.onCreate() (SourceFile:37)
at void android.content.ContentProvider.attachInfo(android.content.Context, android.content.pm.ProviderInfo, boolean) (ContentProvider.java:1917)
06-27 02:36:37.759 17719-17719/com.example.nikhiljindal.testing_start I/zygote: at void android.content.ContentProvider.attachInfo(android.content.Context, android.content.pm.ProviderInfo) (ContentProvider.java:1892)
at void com.google.firebase.provider.FirebaseInitProvider.attachInfo(android.content.Context, android.content.pm.ProviderInfo) (SourceFile:31)
at android.app.ContentProviderHolder android.app.ActivityThread.installProvider(android.content.Context, android.app.ContentProviderHolder, android.content.pm.ProviderInfo, boolean, boolean, boolean) (ActivityThread.java:6239)
at void android.app.ActivityThread.installContentProviders(android.content.Context, java.util.List) (ActivityThread.java:5805)
at void android.app.ActivityThread.handleBindApplication(android.app.ActivityThread$AppBindData) (ActivityThread.java:5722)
at void android.app.ActivityThread.-wrap1(android.app.ActivityThread, android.app.ActivityThread$AppBindData) (ActivityThread.java:-1)
at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1656)
at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:106)
at void android.os.Looper.loop() (Looper.java:164)
at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6494)
at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:-2)
at void com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run() (RuntimeInit.java:438)
at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:807)
06-27 02:36:37.760 17719-17719/com.example.nikhiljindal.testing_start I/zygote: Rejecting re-init on previously-failed class java.lang.Class<com.google.android.gms.internal.zzcmb>: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/internal/zzfjm;
at com.google.android.gms.internal.zzcim com.google.android.gms.internal.zzcim.zzdx(android.content.Context) ((null):-1)
at com.google.android.gms.measurement.AppMeasurement com.google.android.gms.measurement.AppMeasurement.getInstance(android.content.Context) ((null):-1)
at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:-2)
at void com.google.firebase.FirebaseApp.zza(java.lang.Class, java.lang.Object, java.lang.Iterable, boolean) (SourceFile:739)
at void com.google.firebase.FirebaseApp.zze() (SourceFile:709)
at com.google.firebase.FirebaseApp com.google.firebase.FirebaseApp.initializeApp(android.content.Context, com.google.firebase.FirebaseOptions, java.lang.String) (SourceFile:328)
at com.google.firebase.FirebaseApp com.google.firebase.FirebaseApp.initializeApp(android.content.Context, com.google.firebase.FirebaseOptions) (SourceFile:294)
at com.google.firebase.FirebaseApp com.google.firebase.FirebaseApp.initializeApp(android.content.Context) (SourceFile:281)
at boolean com.google.firebase.provider.FirebaseInitProvider.onCreate() (SourceFile:37)
at void android.content.ContentProvider.attachInfo(android.content.Context, android.content.pm.ProviderInfo, boolean) (ContentProvider.java:1917)
at void android.content.ContentProvider.attachInfo(android.content.Context, android.content.pm.ProviderInfo) (ContentProvider.java:1892)
at void com.google.firebase.provider.FirebaseInitProvider.attachInfo(android.content.Context, android.content.pm.ProviderInfo) (SourceFile:31)
at android.app.ContentProviderHolder android.app.ActivityThread.installProvider(android.content.Context, android.app.ContentProviderHolder, android.content.pm.ProviderInfo, boolean, boolean, boolean) (ActivityThread.java:6239)
at void android.app.ActivityThread.installContentProviders(android.content.Context, java.util.List) (ActivityThread.java:5805)
at void android.app.ActivityThread.handleBindApplication(android.app.ActivityThread$AppBindData) (ActivityThread.java:5722)
at void android.app.ActivityThread.-wrap1(android.app.ActivityThread, android.app.ActivityThread$AppBindData) (ActivityThread.java:-1)
at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1656)
at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:106)
at void android.os.Looper.loop() (Looper.java:164)
at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6494)
at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:-2)
at void com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run() (RuntimeInit.java:438)
at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:807)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.internal.zzfjm" on path: DexPathList[[zip file "/data/app/com.example.nikhiljindal.testing_start-qaVCC6CsVTDhpZWzHSJoXg==/base.apk", zip file "/data/app/com.example.nikhiljindal.testing_start-qaVCC6CsVTDhpZWzHSJoXg==/split_lib_dependencies_apk.apk", zip file "/data/app/com.example.nikhiljindal.testing_start-qaVCC6CsVTDhpZWzHSJoXg==/split_lib_resources_apk.apk", zip file "/data/app/com.example.nikhiljindal.testing_start-qaVCC6CsVTDhpZWzHSJoXg==/split_lib_slice_0_apk.apk", zip file "/data/app/com.example.nikhiljindal.testing_start-qaVCC6CsVTDhpZWzHSJoXg==/split_lib_slice_1_apk.apk", zip file "/data/app/com.example.nikhiljindal.testing_start-qaVCC6CsVTDhpZWzHSJoXg==/split_lib_slice_2_apk.apk", zip file "/data/app/com.example.nikhiljindal.testing_start-qaVCC6CsVTDhpZWzHSJoXg==/split_lib_slice_3_apk.apk", zip file "/data/app/com.example.nikhiljindal.testing_start-qaVCC6CsVTDhpZWzHSJoXg==/split_lib_slice_4_apk.apk", zip file "/d
06-27 02:36:37.761 17719-17719/com.example.nikhiljindal.testing_start I/zygote: at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:125)
at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:379)
at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
at com.google.android.gms.internal.zzcim com.google.android.gms.internal.zzcim.zzdx(android.content.Context) ((null):-1)
at com.google.android.gms.measurement.AppMeasurement com.google.android.gms.measurement.AppMeasurement.getInstance(android.content.Context) ((null):-1)
at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:-2)
at void com.google.firebase.FirebaseApp.zza(java.lang.Class, java.lang.Object, java.lang.Iterable, boolean) (SourceFile:739)
at void com.google.firebase.FirebaseApp.zze() (SourceFile:709)
at com.google.firebase.FirebaseApp com.google.firebase.FirebaseApp.initializeApp(android.content.Context, com.google.firebase.FirebaseOptions, java.lang.String) (SourceFile:328)
at com.google.firebase.FirebaseApp com.google.firebase.FirebaseApp.initializeApp(android.content.Context, com.google.firebase.FirebaseOptions) (SourceFile:294)
at com.google.firebase.FirebaseApp com.google.firebase.FirebaseApp.initializeApp(android.content.Context) (SourceFile:281)
at boolean com.google.firebase.provider.FirebaseInitProvider.onCreate() (SourceFile:37)
at void android.content.ContentProvider.attachInfo(android.content.Context, android.content.pm.ProviderInfo, boolean) (ContentProvider.java:1917)
at void android.content.ContentProvider.attachInfo(android.content.Context, android.content.pm.ProviderInfo) (ContentProvider.java:1892)
at void com.google.firebase.provider.FirebaseInitProvider.attachInfo(android.content.Context, android.content.pm.ProviderInfo) (SourceFile:31)
at android.app.ContentProviderHolder android.app.ActivityThread.installProvider(android.content.Context, android.app.ContentProviderHolder, android.content.pm.ProviderInfo, boolean, boolean, boolean) (ActivityThread.java:6239)
at void android.app.ActivityThread.installContentProviders(android.content.Context, java.util.List) (ActivityThread.java:5805)
at void android.app.ActivityThread.handleBindApplication(android.app.ActivityThread$AppBindData) (ActivityThread.java:5722)
at void android.app.ActivityThread.-wrap1(android.app.ActivityThread, android.app.ActivityThread$AppBindData) (ActivityThread.java:-1)
at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1656)
at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:106)
at void android.os.Looper.loop() (Looper.java:164)
at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6494)
at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:-2)
at void com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run() (RuntimeInit.java:438)
at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:807)
06-27 02:36:37.763 17719-17719/com.example.nikhiljindal.testing_start I/zygote: Rejecting re-init on previously-failed class java.lang.Class<com.google.android.gms.internal.zzcmc>: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/internal/zzfjm;
at com.google.android.gms.internal.zzcim com.google.android.gms.internal.zzcim.zzdx(android.content.Context) ((null):-1)
at com.google.android.gms.measurement.AppMeasurement com.google.android.gms.measurement.AppMeasurement.getInstance(android.content.Context) ((null):-1)
at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:-2)
at void com.google.firebase.FirebaseApp.zza(java.lang.Class, java.lang.Object, java.lang.Iterable, boolean) (SourceFile:739)
at void com.google.firebase.FirebaseApp.zze() (SourceFile:709)
at com.google.firebase.FirebaseApp com.google.firebase.FirebaseApp.initializeApp(android.content.Context, com.google.firebase.FirebaseOptions, java.lang.String) (SourceFile:328)
at com.google.firebase.FirebaseApp com.google.firebase.FirebaseApp.initializeApp(android.content.Context, com.google.firebase.FirebaseOptions) (SourceFile:294)
at com.google.firebase.FirebaseApp com.google.firebase.FirebaseApp.initializeApp(android.content.Context) (SourceFile:281)
at boolean com.google.firebase.provider.FirebaseInitProvider.onCreate() (SourceFile:37)
at void android.content.ContentProvider.attachInfo(android.content.Context, android.content.pm.ProviderInfo, boolean) (ContentProvider.java:1917)
at void android.content.ContentProvider.attachInfo(android.content.Context, android.content.pm.ProviderInfo) (ContentProvider.java:1892)
at void com.google.firebase.provider.FirebaseInitProvider.attachInfo(android.content.Context, android.content.pm.ProviderInfo) (SourceFile:31)
read: unexpected EOF!
I see you have firebase in your project, you should use the latest version based on this link like:
Pick what you want, also make sure that in your app gradle google services is updated too: (check this link)
You firebase dependencies must be with same versions, after clean and build the project