更新。我已经阅读了这些问答(Class file for com.google.android.gms.internal.zzaja not found)。但我不明白我需要在我的项目中添加或删除哪些字符串。 因为我的代码中没有这个和其他字符串: 编译 'com.google.android.gms:play-services-location:9.2.0'
我使用 FireBase 开发了一个安卓应用。当我想要构建我的项目时,我遇到了一个错误:
Error:(39, 25) 错误:无法访问 zzanb 找不到 com.google.android.gms.internal.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'
请帮我解决这个错误)
P.S 我已经读过那个问题(Firebase Error cannot access zzanb after using play-services-xxx:9.8.00),但我什么都不懂,在我的情况下我需要从我的 build.gradle 文件中添加或删除什么。
最佳答案
您正在混合使用已发布的新旧 Firebase 库。您使用的来自 Firebase 的所有内容都应该是平等的。这行引用了一个非常旧的 Firebase 版本的库(在它成为 Google 的 Firebase 平台之前):
compile 'com.firebaseui:firebase-ui:0.6.0'
如果你想使用 Firebase-UI 库,你应该使用 the new version of it与您正在使用的主要客户端库的版本相匹配。您使用的是 10.0.1,因此根据我刚刚链接的 Firebase-UI github 上的表格,您需要此依赖项:
compile 'com.firebaseui:firebase-ui:1.1.1'
始终确保您的 Firebase-UI 库与您使用的核心 Firebase SDK 匹配。
关于java - 找不到 FireBase 错误 : cannot access zzanb class file for com. google.android.gms.internal.zzanb,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41837174/