I'm trying to set up an Android project with several Firebase libraries (Auth, Firestore, Vertex AI) using the modern Gradle version catalog (libs.versions.toml). However, Gradle is consistently unable to find and resolve the Firebase dependencies, even though the configuration seems correct.
I am using Android Gradle Plugin 8.13.2 and Kotlin 2.3.0.
Here is my complete configuration:
1. settings.gradle.kts (Root project)
pluginManagement {
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
}
}
rootProject.name = "IAWork"
include(":app")
2. gradle/libs.versions.toml
plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.google.services)
alias(libs.plugins.hilt.android)
id("kotlin-kapt") // Nécessaire pour Hilt
}
android {
namespace = "it.deckcode.iawork"
compileSdk = 36
defaultConfig {
applicationId = "it.deckcode.iawork"
minSdk = 24
targetSdk = 35
versionCode = 1
versionName = "1.0"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
isMinifyEnabled = true
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
}
dependencies {
// Firebase BOM
implementation(platform(libs.firebase.bom))
implementation(libs.firebase.analytics)
implementation(libs.firebase.auth)
implementation(libs.firebase.firestore)
implementation(libs.firebase.vertexai)
// Hilt
implementation(libs.hilt.android)
kapt(libs.hilt.compiler)
// Material Design
implementation(libs.material)
// Standard Android
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.lifecycle.runtime.ktx)
implementation(libs.androidx.activity.compose)
}
The error
When I try to sync of build the project, I get the following error, indicating that some Firebase libraries cannot be found
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Could not find com.google.firebase:firebase-analytics-ktx:.
Required by:
project :app
> Could not find com.google.firebase:firebase-auth-ktx:.
Required by:
project :app
> Could not find com.google.firebase:firebase-firestore-ktx:.
Required by:
project :app
> Could not find com.google.firebase:firebase-vertexai-ktx:.
Required by:
project :app
I have tried clearing the cache (gradle clean) but the issue persists. What could be wrong with my Gradle setup?