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插件行以启用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屋!