首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >找不到com.google.firebase:firebase-analytics:

找不到com.google.firebase:firebase-analytics:
EN

Stack Overflow用户
提问于 2020-11-18 20:22:25
回答 2查看 1.3K关注 0票数 2

我是firebase的新手,并尝试在下一个项目中实现firebase。我如下所示包含了依赖项,但它显示了上面的错误。如果有人能提供信息,我将不胜感激。

我的builder.gradle(App)文件如下:

代码语言:javascript
复制
dependencies {

    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
    implementation 'androidx.core:core-ktx:1.3.2'
    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'com.google.android.material:material:1.2.1'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
    implementation 'androidx.navigation:navigation-fragment-ktx:2.2.2'
    implementation 'androidx.navigation:navigation-ui-ktx:2.2.2'

    implementation 'com.google.firebase:firebase-analytics'
    implementation 'com.google.firebase:firebase-firestore'

    testImplementation 'junit:junit:4.+'
    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
apply plugin: 'com.google.gms.google-services'
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2020-11-19 00:10:53

当您将Firebase集成到您的应用程序中时,您必须从两种adding dependencies, according to the documentation方式中选择一种。您可以选择使用每个依赖项的特定版本,如下所示:

代码语言:javascript
复制
    implementation 'com.google.firebase:firebase-analytics:18.0.0'
    implementation 'com.google.firebase:firebase-firestore:22.0.0'

或者,您可以使用Firebase BoM根据单个BoM版本为您选择它们,该版本将为您应用特定的兼容版本:

代码语言:javascript
复制
    // Import the Firebase BoM
    implementation platform('com.google.firebase:firebase-bom:26.1.0')

    // versions for Firebase SDKs are chosen automatically by the BoM
    implementation 'com.google.firebase:firebase-analytics'
    implementation 'com.google.firebase:firebase-firestore'

看起来您尝试使用BoM,但没有添加用于选择平台的行。

票数 4
EN

Stack Overflow用户

发布于 2020-11-18 20:51:50

您需要像对其他依赖项所做的那样指定明确的版本号。例如:

代码语言:javascript
复制
implementation 'com.google.firebase:firebase-analytics:18.0.0'
implementation 'com.google.firebase:firebase-firestore:22.0.0'

您可以在此处找到有关firebase版本的更多信息--> https://firebase.google.com/support/release-notes/android

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/64893041

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档