Я пытаюсь добавить базу данных Firebase в реальном времени в мое Android приложение. Он работает нормально, пока я не добавлю
implementation 'com.google.firebase:firebase-database:19.2.1'
в свой Gradle (модуль: App), чтобы добавить базу данных Firebase в реальном времени. После добавления этого моего приложения происходит сбой при запуске. Во-первых, он показывает ошибку cra sh, говорящую «Запустите приложение заново», а после нажатия снова вылетает и выдает «закрыть приложение». Я попытался выполнить поиск в Google, но не смог найти ответ на эту конкретную проблему. Кто-нибудь может дать какие-нибудь подсказки? Вот все зависимости gradle
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'de.hdodenhof:circleimageview:3.1.0'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.firebase:firebase-auth:16.0.5'
implementation 'androidx.annotation:annotation:1.1.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation 'com.google.firebase:firebase-database:19.2.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'com.google.android.material:material:1.1.0'
//noinspection GradleCompatible,GradleCompatible
implementation 'com.android.support:cardview-v7:28.0.0'
}
Вот часть файла журнала красного цвета:
--------- beginning of crash
2020-03-11 18:45:31.616 6390-6390/com.example.firebasechat E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.firebasechat, PID: 6390
java.lang.NoSuchMethodError: No virtual method setTokenProvider(Lcom/google/firebase/internal/InternalTokenProvider;)V in class Lcom/google/firebase/FirebaseApp; or its super classes (declaration of 'com.google.firebase.FirebaseApp' appears in /data/app/com.example.firebasechat-1/base.apk)
at com.google.firebase.auth.zzp.create(Unknown Source)
at com.google.firebase.components.ComponentRuntime.lambda$new$0(com.google.firebase:firebase-components@@16.0.0:69)
at com.google.firebase.components.ComponentRuntime$$Lambda$1.get(com.google.firebase:firebase-components@@16.0.0)
at com.google.firebase.components.Lazy.get(com.google.firebase:firebase-components@@16.0.0:53)
at com.google.firebase.components.ComponentRuntime.initializeEagerComponents(com.google.firebase:firebase-components@@16.0.0:158)
at com.google.firebase.FirebaseApp.initializeAllApis(com.google.firebase:firebase-common@@19.3.0:563)
at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:firebase-common@@19.3.0:304)
at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:firebase-common@@19.3.0:268)
at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:firebase-common@@19.3.0:253)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(com.google.firebase:firebase-common@@19.3.0:51)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1751)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1726)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(com.google.firebase:firebase-common@@19.3.0:45)
at android.app.ActivityThread.installProvider(ActivityThread.java:5811)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5403)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5342)
at android.app.ActivityThread.-wrap2(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1528)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)
2020-03-11 18:45:31.961 6390-6409/com.example.firebasechat W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
2020-03-11 18:45:32.056 6390-6409/com.example.firebasechat I/FirebaseAuth: [FirebaseAuth:] Loading module via FirebaseOptions.
2020-03-11 18:45:32.056 6390-6409/com.example.firebasechat I/FirebaseAuth: [FirebaseAuth:] Preparing to create service connection to gms implementation