Android Studio 错误:接口用作包含 firebase-core:16.0.4 时的超类 [英] Android Studio Error: Interface used as super class of when include firebase-core:16.0.4
问题描述
我在包含时出错
implementation 'com.google.firebase:firebase-core:16.0.4'
在 builde.gradle 中
in builde.gradle
Error: Interface `com.google.android.gms.measurement.internal.zzah(classpath class)` used as super class of `com.google.android.gms.measurement.internal.zzbv`.
推荐答案
如果您想将 Firebase 库集成到您自己的项目之一中,您需要执行一些基本任务来准备您的 Android Studio 项目.在将 Firebase 添加到您的应用时,您可能已经这样做了.
If you would like to integrate the Firebase libraries into one of your own projects, you need to perform a few basic tasks to prepare your Android Studio project. You may have already done this as part of adding Firebase to your app.
首先,将规则添加到您的根级 build.gradle 文件中,以包含 google-services 插件和 Google 的 Maven 存储库:
First, add rules to your root-level build.gradle file, to include the google-services plugin and the Google's Maven repository:
buildscript {
// ...
dependencies {
// ...
classpath 'com.google.gms:google-services:4.2.0' // google-services plugin
}
}
allprojects {
// ...
repositories {
// ...
google() // Google's Maven repository
}
}
然后,在您的模块 Gradle 文件(通常是 app/build.gradle)中,在文件底部添加 apply plugin 行以启用 Gradle 插件:
Then, in your module Gradle file (usually the app/build.gradle), add the apply plugin line at the bottom of the file to enable the Gradle plugin:
apply plugin: 'com.android.application'
android {
// ...
}
dependencies {
// ...
implementation 'com.google.firebase:firebase-core:16.0.6'
// Getting a "Could not find" error? Make sure you have
// added the Google maven respository to your root build.gradle
}
// ADD THIS AT THE BOTTOM
apply plugin: 'com.google.gms.google-services'
这篇关于Android Studio 错误:接口用作包含 firebase-core:16.0.4 时的超类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!