首页 > 解决方案 > 尝试实施 Google Speech to Text 后,名称为 [DEFAULT] 的 FirebaseApp 不存在

问题描述

我有一个使用 Firestore 的应用程序。然后我尝试将 Google Speech to Text 添加到应用程序中,突然 Firestore 连接停止工作。在这里,我将在 app/build.gradle 脚本之前和之后发布,希望任何人都可以看到这个问题。我不会发布脚本中没有更改的部分。

前:

dependencies {
    implementation 'androidx.legacy:legacy-support-v13:1.0.0'
    implementation 'androidx.browser:browser:1.2.0'
    implementation 'com.squareup.okhttp3:okhttp:4.8.0'
    implementation 'com.google.code.gson:gson:2.8.6'
    implementation 'dev.dworks.libs:astickyheader:0.1.0'
    implementation 'se.emilsjolander:stickylistheaders:2.7.0'
    implementation 'com.github.wangjiegulu:AndroidBucket:1.0.4'
    implementation 'com.android.support:preference-v7:29.0.0'
    implementation "androidx.appcompat:appcompat:1.1.0"
    implementation 'com.google.firebase:firebase-analytics:17.5.0'
    implementation 'com.android.support:support-v4:29.0.0'
    implementation 'com.android.support:support-annotations:28.0.0'
    implementation 'com.google.firebase:firebase-firestore:21.6.0'
}

dependencies {
    implementation 'androidx.legacy:legacy-support-v13:1.0.0'
    implementation 'androidx.browser:browser:1.2.0'
    implementation 'com.squareup.okhttp3:okhttp:4.8.0'
    implementation 'com.google.code.gson:gson:2.8.6'
    implementation 'dev.dworks.libs:astickyheader:0.1.0'
    implementation 'se.emilsjolander:stickylistheaders:2.7.0'
    implementation 'com.github.wangjiegulu:AndroidBucket:1.0.4'
    implementation 'com.android.support:preference-v7:29.0.0'
    implementation "androidx.appcompat:appcompat:1.2.0"
    //implementation 'com.google.firebase:firebase-analytics:17.5.0'
    implementation 'com.android.support:support-v4:29.0.0'
    implementation 'com.android.support:support-annotations:28.0.0'
    implementation fileTree(include: '*.jar', dir: 'libs')
    implementation ('com.google.firebase:firebase-firestore:21.6.0') {
        exclude(group: 'com.google.firebase', module: 'firebase-database-collection')
        exclude(group: 'com.google.firebase', module: 'firebase-auth-interop')
        exclude(group: 'com.google.firebase', module: 'firebase-common')
    }
    implementation 'com.google.api.grpc:grpc-google-cloud-speech-v1:1.23.0'
    implementation 'com.google.firebase:firebase-admin:6.2.0'
}
configurations.implementation.exclude(group: 'com.google.firebase', module: 'protolite-well-known-types')
configurations.implementation.exclude(group: 'com.google.guava', module: 'guava-jdk5')
configurations.implementation.exclude(group: 'com.google.protobuf', module: 'protobuf-javalite')
configurations.implementation.exclude(group: 'com.google.firebase', module: 'firebase-auth-interop')
configurations.implementation.exclude(group: 'com.google.firebase', module: 'firebase-common')*/
configurations.implementation.exclude(group: 'com.google.android.gms', module: 'play-services-basement')

更改会产生以下错误:java.lang.IllegalStateException: FirebaseApp with name [DEFAULT] 不存在。

是什么导致我出现这些问题?

标签: androidfirebasegradlegoogle-cloud-firestoredependencies

解决方案


推荐阅读