FireBase错误:无法访问com.google.android.gms.internal.zzanb找不到zzanb类文件

UPD 。 我已阅读这些问题和答案( 未找到com.google.android.gms.internal.zzaja的类文件 )。 但我不明白我需要在项目中添加或删除哪些字符串。 因为我的代码中没有这个和其他字符串:编译’com.google.android.gms:play-services-location:9.2.0′

我开发了一个使用FireBase的Android应用程序。 当我想构建我的项目时,我有一个错误:

错误:(39,25)错误:无法访问com.google.android.gms.internal.zzanb找不到zzanb类文件

该错误是由调用语句引起的: FirebaseAuth.getInstance()。getCurrentUser();

项目build.gradle:

// Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.2.3' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files classpath 'com.google.gms:google-services:3.0.0' } } allprojects { repositories { jcenter() } } task clean(type: Delete) { delete rootProject.buildDir } 

模块build.gradle:

 apply plugin: 'com.android.application' android { compileSdkVersion 25 buildToolsVersion "25.0.2" defaultConfig { applicationId "xxx.yyy.zzz" minSdkVersion 19 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(include: ['*.jar'], dir: 'libs') compile 'com.android.support:appcompat-v7:25.1.0' compile 'com.google.firebase:firebase-core:10.0.1' testCompile 'junit:junit:4.12' compile 'com.android.support:design:25.1.0' compile 'com.firebaseui:firebase-ui:0.6.0' compile 'com.android.support.test.espresso:espresso-core:2.2.2' } apply plugin: 'com.google.gms.google-services' 

请帮我解决这个错误)

PS我已经读过这个问题( Firebase Error在使用play-services-xxx后无法访问zzanb:9.8.00 ),但我不明白,在我的情况下我需要添加或删除我的build.gradle文件。

您正在混合发布新旧Firebase的库。 您使用的Firebase中的所有内容都应该是平价的。 这一行引用了一个非常古老的Firebase版本的库(在它成为Google的Firebase平台之前):

 compile 'com.firebaseui:firebase-ui:0.6.0' 

如果要使用Firebase-UI库,则应使用与您正在使用的主客户端库版本匹配的新版本 。 你正在使用10.0.1,所以根据我刚刚链接的Firebase-UI github上的表,你想要这个依赖:

 compile 'com.firebaseui:firebase-ui:1.1.1' 

始终确保您的Firebase-UI库与您正在使用的核心Firebase SDK相匹配。

看起来在你的情况下, Doug的修复程序解决了你的问题,但我们最近遇到了同样的问题,其原因不同。

在我们的示例中,我们已将IDE项目配置为使用JDK8,但未能检查终端中正在使用的JDK版本。 因为当你键入’react-native run-android’时,React Native从命令行运行Gradle,Gradle试图使用JDK10进行构建,这导致了明显的问题,因为Android目前只支持JDK8。 一旦我们配置终端使用JDK8,问题就解决了。

TL; DR:检查终端中使用的JDK版本。