Search code examples
javaandroidfirebasegradlefirebaseui

Android Firebase UI cannot access aad


I am coming across the following error when I go to run my app: cannot access aad class file for com.google.android.gms.internal.aad not found

I'd imagine this would be a build.gradle issue. However I cannot find anything in my build files that seem off.

Here is the top level build.gradle

buildscript {
repositories {
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:2.3.3'
    classpath 'com.google.gms:google-services:3.1.0'
}
}

allprojects {
repositories {
    jcenter()
    maven {
        url "https://maven.google.com"
    }
}
}

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

And Here is the app level build.grade:

apply plugin: 'com.android.application'

android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
    applicationId "com.somesite.foo"
    minSdkVersion 16
    targetSdkVersion 26
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    resConfigs "auto"
}
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.android.support:appcompat-v7:26.+'
testCompile 'junit:junit:4.12'
compile 'com.google.firebase:firebase-core:11.2.0'
compile 'com.firebaseui:firebase-ui-auth:2.3.0'
compile('com.facebook.android:facebook-android-sdk:4.22.1')
}

apply plugin: 'com.google.gms.google-services'

here is the activity that's trying to get everything started:

protected void onCreate(Bundle savedInstanceState) {
    setTheme(R.style.SplashTheme);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_splash);
    FirebaseAuth auth = FirebaseAuth.getInstance();
    if (auth.getCurrentUser() != null)
    {
        // already signed in
        auth.signOut();
    }
    else
    {
        //AuthU
        // not signed in
        startActivityForResult(
                AuthUI.getInstance()
                        .createSignInIntentBuilder()
                        .setIsSmartLockEnabled(false)
                        .setAvailableProviders(
                                Arrays.asList(new AuthUI.IdpConfig.Builder(AuthUI.EMAIL_PROVIDER).build(),
                                        new AuthUI.IdpConfig.Builder(AuthUI.GOOGLE_PROVIDER).build(),
                                        new AuthUI.IdpConfig.Builder(AuthUI.FACEBOOK_PROVIDER).build()))
                        .build(),
                RC_SIGN_IN);
    }

}

Solution

  • The problem is likely caused by firebase-ui-auth:2.3.0 not being compatible with firebase-core:11.2.0. The simplest fix is to downgrade to 11.0.4, the version that is compatible with firebase-ui-auth:2.3.0:

    compile 'com.google.firebase:firebase-core:11.0.4' // CHANGED
    compile 'com.firebaseui:firebase-ui-auth:2.3.0'
    compile('com.facebook.android:facebook-android-sdk:4.22.1')
    

    If you want to stick with 11.2.0, you can bridge 2.3.0 up to use version 11.2.0 with these changes:

    compile 'com.google.firebase:firebase-core:11.2.0'
    compile 'com.google.firebase:firebase-auth:11.2.0' // ADDED
    compile 'com.google.android.gms:play-services-auth:11.2.0' // ADDED
    compile 'com.firebaseui:firebase-ui-auth:2.3.0'
    compile('com.facebook.android:facebook-android-sdk:4.22.1')
    

    See the FirebaseUI documentation for an explanation of library version compatibility.