无法解析符号" FirebaseAuth"

时间:2018-03-09 02:23:08

标签: android android-studio

尽管我补充说,我仍然有这个错误  编译com.google.android.gms:play-services-auth:11.8.0'     编译" com.google.android.gms:play-services-gcm:11.8.0"到build.gradle(app)。请帮我解决这个问题。

2 个答案:

答案 0 :(得分:0)

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:3.2.0' // google-services 
plugin
}
}

 allprojects {
// ...
repositories {
    // ...
    maven {
        url "https://maven.google.com" // 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 {
 // ...
 compile 'com.google.firebase:firebase-core:11.8.0'
  // 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'

答案 1 :(得分:0)

您可能需要确保您的活动正在导入Firebase Auth模块。
在您活动的.java文件中(例如Login.java):

    import com.google.firebase.auth.FirebaseAuth;