Android Studio Error: Interface used as super class of when include firebase-core:16.0.4

旧巷老猫 提交于 2020-01-24 20:20:35

问题


I get Error when include

implementation 'com.google.firebase:firebase-core:16.0.4'

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`.

回答1:


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.

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
}

}

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'



回答2:


I think there was a Google and Firebase Library versions mismatch. For me following combination work, If any body face problem like this :

//Google
implementation "com.google.android.gms:play-services-auth:16.0.1"
implementation "com.google.android.gms:play-services-gcm:16.0.0"
implementation "com.google.android.gms:play-services-location:16.0.0"

//Firebase
implementation 'com.google.firebase:firebase-core:16.0.4'
implementation 'com.google.firebase:firebase-messaging:17.3.3'
implementation "com.google.firebase:firebase-auth:16.0.4"
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.5'
implementation 'com.google.firebase:firebase-invites:16.0.4'


来源:https://stackoverflow.com/questions/53645424/android-studio-error-interface-used-as-super-class-of-when-include-firebase-cor

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!