android app crashes when adding firebase ML vision dependencies with firebase database dependencies

岁酱吖の 提交于 2019-12-13 08:36:09

问题


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!

回答1:


I see you have firebase in your project, you should use the latest version based on this link like:

    implementation 'com.crashlytics.sdk.android:crashlytics:2.9.4'
    implementation 'com.google.firebase:firebase-core:16.0.1'
    implementation 'com.google.firebase:firebase-ads:15.0.1'
    implementation 'com.google.firebase:firebase-analytics:16.0.1'
    implementation 'com.google.firebase:firebase-appindexing:16.0.1'
    implementation 'com.google.firebase:firebase-auth:16.0.2'
    implementation 'com.google.firebase:firebase-firestore:17.0.2'
    implementation 'com.google.firebase:firebase-functions:16.0.1'
    implementation 'com.google.firebase:firebase-messaging:17.0.0'
    implementation 'com.google.firebase:firebase-storage:16.0.1'
    implementation 'com.google.firebase:firebase-crash:16.0.1'
    implementation 'com.google.firebase:firebase-invites:16.0.1'
    implementation 'com.google.firebase:firebase-perf:16.0.0'
    implementation 'com.google.firebase:firebase-database:16.0.1'
    implementation 'com.google.firebase:firebase-config:16.0.0'

Pick what you want, also make sure that in your app gradle google services is updated too: (check this link)

classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.google.gms:google-services:4.0.1'



回答2:


You firebase dependencies must be with same versions, after clean and build the project



来源:https://stackoverflow.com/questions/51051141/android-app-crashes-when-adding-firebase-ml-vision-dependencies-with-firebase-da

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!