【问题标题】:Updated Android Studio - Firebase Auth Fails更新的 Android Studio - Firebase 身份验证失败
【发布时间】:2017-07-25 16:35:15
【问题描述】:

在我今天更新 Android Studio、Android Support Repository、Google Play Services 和 Google Repository 之前,一切正常。现在我无法通过我的登录屏幕。正如我在标题中提到的,我使用 Firebase 进行身份验证和数据存储。

我也在使用模拟器:Nexus 6p API 23

这是我尝试登录时遇到的错误

03-05 13:39:50.689 2790-2852/alodia.medremind W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
03-05 13:39:50.698 2790-2852/alodia.medremind W/GooglePlayServicesUtil: Google Play services out of date.  Requires 10298000 but found 10084470

这是我的项目 build.gradle:

buildscript {
repositories {
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:2.2.3'
    classpath 'com.google.gms:google-services:3.0.0'
    classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
}
}

allprojects {
repositories {
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

这是我的应用 build.gradle:

apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "alodia.medremind"
        minSdkVersion 15
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})

compile 'com.astuetz:pagerslidingtabstrip:1.0.1'
compile 'com.android.support:appcompat-v7:25.2.0'
compile 'com.android.support:design:25.2.0'
compile 'com.android.support:recyclerview-v7:25.2.0'
compile 'com.github.paolorotolo:appintro:4.1.0'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.google.firebase:firebase-core:10.2.0'
compile "com.google.firebase:firebase-auth:10.2.0"
compile "com.google.firebase:firebase-database:10.2.0"
compile "com.google.firebase:firebase-storage:10.2.0"

compile 'com.firebaseui:firebase-ui-database:1.2.0'
compile 'org.parceler:parceler-api:1.1.1'

compile 'com.android.support:support-v4:25.2.0'
compile 'com.android.support:cardview-v7:25.2.0'
testCompile 'junit:junit:4.12'
apt 'org.parceler:parceler:1.1.1'
}
apply plugin: 'com.google.gms.google-services'

能够解决这个问题真是太好了,但我最想知道这个问题背后的原因。我对 Android 还很陌生,我确信我误解了很多基本概念。

【问题讨论】:

  • 清理并重建您的项目可能会对您有所帮助
  • 不幸的是,我已经这样做了很多次了。

标签: android firebase firebase-authentication


【解决方案1】:

您的 google play 服务必须是 10.2.0 或更高版本:

'com.google.gms:google-services:10.2.0'

【讨论】:

  • 那么有两个问题。首先,您如何从上面的错误中收集到这些信息?其次,我把它放在哪里?当我将它放在应用程序 build.gradle 中时,我收到以下错误:错误:配置项目“:应用程序”时出现问题。 > 无法解析配置“:app:_debugApkCopy”的所有依赖项。 > 找不到 com.google.gms:google-services:9.0.0。要求:MedRemind:app:unspecified
  • 将其放在您的应用构建 gradle 上,并将其从项目 gradle 中删除。 “Google Play 服务已过期”。错误表明您的播放服务版本太旧
  • 从项目 build.gradle 中删除它会导致此错误:错误:(49, 0) 未找到 ID 为 'com.google.gms.google-services' 的插件。
  • 仅将应用构建 gradle 更改为包含 compile 'com.google.gms:google-services:10.2.0' 会导致此错误:错误:找不到 com.google.gms:google-服务:10.2.0。要求:MedRemind:app:unspecified 在 build.gradle 文件中搜索
  • 您的应用文件夹中有“google-services.json”文件吗?
【解决方案2】:

清理你的项目并重新构建,如果没有成功,你可以参考this post

【讨论】:

    【解决方案3】:

    您的模拟器系统映像没有最新版本 (10.2.98) 的 Google Play 服务。

    在 Android Studio 中,打开 SDK 管理器并选中 Show Package Details 框。因为您正在使用 API 23 图像进行测试,所以向下滚动到 Android 6.0 部分。使用 Google APIs ... System Image 形式的名称更新模拟器图像。最新的是 Rev 20。

    当您运行模拟器时,您可以通过转到设置 > 应用程序,滚动到 Google Play 服务,然后单击查看版本来确认您拥有最新版本应用信息中的编号。

    【讨论】:

      【解决方案4】:

      我通过将手机中的 Google Play 服务从 8.0 更新到 11.0 解决了这个问题。

      【讨论】:

        【解决方案5】:

        我刚刚解决了我的问题兄弟,我认为您只需要重新同步 firebase,按照此步骤单击选项卡工具 -> firebase -> 选择 firebase 功能的 1 -> 如果连接的按钮为灰色,您必须重新同步 firebase,它会将 firebase 配置更新到最新版本。希望它会有所帮助。

        【讨论】:

          【解决方案6】:

          确保在将项目连接到 firebase 后,已将 firebase 身份验证添加到项目中。

          【讨论】:

            猜你喜欢
            • 2017-11-27
            • 2019-03-09
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 2016-09-27
            • 2020-07-09
            • 1970-01-01
            相关资源
            最近更新 更多