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

前端 未结 2 1521
醉梦人生
醉梦人生 2021-01-23 04:31

I get Error when include

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

in builde.gradle

Error: Interface `com.go         


        
相关标签:
2条回答
  • 2021-01-23 05:34

    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'
    
    0 讨论(0)
  • 2021-01-23 05:35

    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'
    
    0 讨论(0)
提交回复
热议问题