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

前端 未结 2 1522
醉梦人生
醉梦人生 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'
    

提交回复
热议问题