Udacity Firebase教程添加Firebase UI Auth依赖后Gradle构建失败求助
com.firebaseui:firebase-ui-auth:3.2.2 Hey there! Let's work through this Gradle build issue you ran into after adding the FirebaseUI Auth dependency. This is almost always a version compatibility problem—older FirebaseUI releases require specific Firebase SDK versions to play nice together. Here's how to fix it step by step:
1. Align Firebase SDK Versions with FirebaseUI 3.2.2
FirebaseUI Auth 3.2.2 requires Firebase SDK version 11.8.0 for core services like Auth and Core. Make sure all your Firebase-related dependencies in your app-level build.gradle use this exact version. For example:
// App-level build.gradle dependencies { // Match these versions to FirebaseUI 3.2.2 implementation 'com.google.firebase:firebase-core:11.8.0' implementation 'com.google.firebase:firebase-auth:11.8.0' implementation 'com.firebaseui:firebase-ui-auth:3.2.2' // Your other project dependencies... }
2. Update Google Services Plugin (Project-level)
You'll also need to use the matching version of the Google Services plugin in your project-level build.gradle. For Firebase SDK 11.8.0, stick with version 3.2.1:
// Project-level build.gradle buildscript { dependencies { classpath 'com.google.gms:google-services:3.2.1' // Other classpath dependencies... } }
3. Clean & Rebuild Your Project
Cached build files often cause weird conflicts. Try these steps to reset:
- Go to
Build > Clean Projectin Android Studio - Then select
Build > Rebuild Project - If that doesn't work, manually delete the
.gradlefolder (in your project root) andbuildfolders (in your app module), then re-sync your Gradle files.
4. Resolve Dependency Conflicts
If errors persist, run this command in your terminal to check for conflicting dependencies:
./gradlew app:dependencies
Look for any libraries pulling in a different version of Firebase Auth/Core. You can exclude conflicting versions from the FirebaseUI dependency like this:
implementation('com.firebaseui:firebase-ui-auth:3.2.2') { exclude group: 'com.google.firebase', module: 'firebase-auth' }
Just make sure you've already explicitly added the correct 11.8.0 version of firebase-auth as shown in step 1.
A quick heads-up: FirebaseUI 3.2.2 is pretty old. If your project allows, consider upgrading to a newer, supported version of FirebaseUI and Firebase SDKs to avoid future compatibility headaches.
内容的提问来源于stack exchange,提问作者Sweetie Anang

