Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FireBase Error: cannot access zzanb class file for com.google.android.gms.internal.zzanb not found

UPD. I have read these question and answer (Class file for com.google.android.gms.internal.zzaja not found). But I doesnt understand what strings i need to add or remove in my project. Because I havent this and other strings in my code: compile 'com.google.android.gms:play-services-location:9.2.0'

I develop an android app with use of FireBase. And when I want to build my project I have an error:

Error:(39, 25) error: cannot access zzanb class file for com.google.android.gms.internal.zzanb not found

The error was caused by invoking statement: FirebaseAuth.getInstance().getCurrentUser();

Projects 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
}

Modules 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'

Please, help me to solve that error)

P.S I have already read that question (Firebase Error cannot access zzanb after using play-services-xxx:9.8.00), but i didnt understand anything, what i need to add or remove from my build.gradle files in my situation.

like image 961
Олег Медведев Avatar asked Jan 24 '17 19:01

Олег Медведев


2 Answers

You're mixing libraries from old and new Firebase released. Everything from Firebase that you use should be in parity. This line is reference an library from a very old Firebase release (before it became the Firebase platform at Google):

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

If you want to use the Firebase-UI library, you should use the new version of it that matches the version of the main client library you're using. You're using 10.0.1, so according to the table on the Firebase-UI github I just linked, you want this dependency:

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

Always make sure your Firebase-UI library matches the core Firebase SDK you're using.

like image 187
Doug Stevenson Avatar answered Nov 08 '22 06:11

Doug Stevenson


It looks like in your case Doug's fix resolved your issue, but we recently encountered the same problem with a different root cause.

In our case, we had configured our IDE project to use JDK8 but failed to check which version of the JDK was in use in the terminal. Because React Native runs Gradle from the command line when you type 'react-native run-android' Gradle was attempting to build using JDK10 which caused obvious issues since Android currently only supports up to JDK8. Once we configured the terminal to use JDK8 the issue was resolved.

TL;DR: Check what version of the JDK you are using in the terminal.

like image 33
ZardozSpeaks Avatar answered Nov 08 '22 05:11

ZardozSpeaks