androidfirebasegradleandroid-gradle-pluginbuild.gradle

Gradle cannot find Firebase libraries (firebase-auth-ktx, storage-ktx, etc.) after updating to Firebase BoM 34.2.0


I have an old Android app, and after opening it, I see some libraries need to be updated, and after I do that, I get some errors, most of it about Google Firebase libs

the error Log

> Task :app:mergeDebugResources FAILED
Execution failed for task ':app:mergeDebugResources'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
   > Could not find com.google.firebase:firebase-storage-ktx:.
     Required by:
         project :app
   > Could not find com.google.firebase:firebase-crashlytics-ktx:.
     Required by:
         project :app
   > Could not find com.google.firebase:firebase-analytics-ktx:.
     Required by:
         project :app
   > Could not find com.github.bumptech.glide:gifdecoder:5.0.0.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/github/bumptech/glide/gifdecoder/5.0.0/gifdecoder-5.0.0.pom
       - https://repo.maven.apache.org/maven2/com/github/bumptech/glide/gifdecoder/5.0.0/gifdecoder-5.0.0.pom
     Required by:
         project :app > com.github.bumptech.glide:glide:5.0.0
   > Could not find com.github.bumptech.glide:disklrucache:5.0.0.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/github/bumptech/glide/disklrucache/5.0.0/disklrucache-5.0.0.pom
       - https://repo.maven.apache.org/maven2/com/github/bumptech/glide/disklrucache/5.0.0/disklrucache-5.0.0.pom
     Required by:
         project :app > com.github.bumptech.glide:glide:5.0.0

Possible solution:
 - Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html

Ask Gemini

This is my build.gradle (app module) file after update

plugins {
    id 'com.android.application'
    id 'org.jetbrains.kotlin.android'
    id 'dagger.hilt.android.plugin'
    id "androidx.navigation.safeargs.kotlin"
    id 'kotlin-parcelize'
    id 'com.google.android.libraries.mapsplatform.secrets-gradle-plugin'
//    id 'kotlin-kapt'
    id 'com.google.devtools.ksp'
    id 'com.google.gms.google-services'
    id 'com.google.firebase.crashlytics'
}

def localProps = new Properties()
def localPropsFile = rootProject.file("local.properties")
if (localPropsFile.exists()) {
    localProps.load(new FileInputStream(localPropsFile))
}

android {
    signingConfigs {
        release {
            storeFile file(var)
            storePassword '123'
            keyAlias 'key0'
            keyPassword '123'
        }
    }
    namespace 'com.blogspot.mido_mymall'

    compileSdkVersion 36

    defaultConfig {
        applicationId "com.blogspot.mido_mymall"
        minSdk 23
        targetSdk 36
        versionCode 12
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"


    }


    buildTypes {
        release {
            debuggable false
            minifyEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.release
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_17
        targetCompatibility JavaVersion.VERSION_17
    }
    kotlinOptions {
        jvmTarget = '17'
    }

    buildFeatures {
        viewBinding = true
        buildConfig = true
    }
}

dependencies {

    implementation 'androidx.core:core-ktx:1.17.0'
    implementation 'androidx.appcompat:appcompat:1.7.1'
    implementation 'com.google.android.material:material:1.12.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.2.1'
    implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.3.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.7.0'

    implementation("androidx.gridlayout:gridlayout:1.1.0")


    def hilt_version = '2.57.1'
    implementation "com.google.dagger:hilt-android:$hilt_version"
    ksp "com.google.dagger:hilt-compiler:$hilt_version"

    def navigation_version = "2.9.3"
    implementation "androidx.navigation:navigation-fragment-ktx:$navigation_version"
    implementation "androidx.navigation:navigation-ui-ktx:$navigation_version"

    implementation 'com.intuit.sdp:sdp-android:1.1.1'
    implementation 'com.intuit.ssp:ssp-android:1.1.1'

    implementation 'com.google.firebase:firebase-auth-ktx:23.2.1'
    implementation 'com.google.android.gms:play-services-auth:21.4.0'
    implementation platform('com.google.firebase:firebase-bom:34.2.0')
    implementation 'com.google.firebase:firebase-firestore:26.0.0'
    implementation("com.google.firebase:firebase-storage-ktx")
    implementation("com.google.firebase:firebase-crashlytics-ktx")
    implementation("com.google.firebase:firebase-analytics-ktx")



    implementation("com.google.android.gms:play-services-ads:24.5.0")


    implementation 'de.hdodenhof:circleimageview:3.1.0'

    //Glide
    implementation 'com.github.bumptech.glide:glide:5.0.0'
    ksp 'com.github.bumptech.glide:compiler:4.16.0'


    implementation 'com.facebook.shimmer:shimmer:0.5.0'

    //Retrofit
    implementation 'com.squareup.retrofit2:retrofit:3.0.0'
    implementation 'com.squareup.retrofit2:converter-gson:3.0.0'

    //interceptor
    implementation "com.squareup.okhttp3:logging-interceptor:5.1.0"

    implementation 'com.razorpay:checkout:1.6.41'

    // DataStore
    implementation 'androidx.datastore:datastore-preferences:1.1.7'

    implementation 'com.airbnb.android:lottie:6.6.7'


//    implementation 'com.github.omarzer0:az-edittext:0.1.2'

//    implementation 'com.borjabravo:readmoretextview:2.1.0'

    implementation("androidx.lifecycle:lifecycle-process:2.9.3")
    implementation 'androidx.multidex:multidex:2.0.1'
    implementation 'com.google.android.ump:user-messaging-platform:3.2.0'

this the old working version of this libs

    implementation 'com.google.firebase:firebase-auth-ktx:23.2.0'
    implementation 'com.google.android.gms:play-services-auth:21.3.0'
    implementation platform('com.google.firebase:firebase-bom:33.13.0')
    implementation 'com.google.firebase:firebase-firestore:25.1.4'
    implementation("com.google.firebase:firebase-storage-ktx")

    implementation("com.google.firebase:firebase-crashlytics-ktx")
    implementation("com.google.firebase:firebase-analytics-ktx")



    implementation("com.google.android.gms:play-services-ads:24.5.0")


    implementation 'de.hdodenhof:circleimageview:3.1.0'

    //Glide
    implementation 'com.github.bumptech.glide:glide:4.16.0'
    ksp 'com.github.bumptech.glide:compiler:4.16.0'

What I tried to fix so far:

    implementation platform("com.google.firebase:firebase-bom:34.2.0")

    implementation "com.google.firebase:firebase-auth-ktx"
    implementation "com.google.firebase:firebase-storage-ktx"
    implementation "com.google.firebase:firebase-crashlytics-ktx"
    implementation "com.google.firebase:firebase-analytics-ktx"

Solution

  • The -ktx libraries are no longer needed with recent Firebase SDKs for Android. The Kotlin functionality has been merged into the main SDKs.

    Also see the Firebase documentation: Migrate to using the Kotlin extensions (KTX) APIs in the main modules, specifically the section on How to migrate to use KTX APIs from the main modules. It mostly means that you can drop the -ktx from the imports:

    implementation platform("com.google.firebase:firebase-bom:34.2.0")
    
    implementation "com.google.firebase:firebase-auth"
    implementation "com.google.firebase:firebase-storage"
    implementation "com.google.firebase:firebase-crashlytics"
    implementation "com.google.firebase:firebase-analytics"