androidfirebasegradlecrashlytics

Building gradle app fails when com.google.firebase:firebase-bom is updated to 32.6.0


I'm trying to upgrade com.google.firebase:firebase-bom from version 29.0.0 to 32.6.0 and I ran into this error:

/Users/macuser/.gradle/caches/transforms-3/467bb9d3066a57ac5f94cf19b169a6ba/transformed/jetified-play-services-measurement-api-21.5.0-api.jar!/META-INF/java.com.google.android.gmscore.integ.client.measurement_api_measurement_api.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.6.0.

Does this version have a specific gradle version required?

At the moment, my gradle version is 7.3.3 and kotlin dependencies versions are as below:

org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.21
org.jetbrains.kotlin:kotlin-reflect:1.6.21

I've tried deleting gradle cache and even the .gradle folder itself but nothing seems to work.

What could be the issue and how may I solve this? Any input is appreciated.


Solution

  • Below project is configured with AGP version 8.2.2

    1. Check project level build.gradle > kotlin version make it 1.9 from 1.6.
    // Top-level build file where you can add configuration options common to all sub-projects/modules.
    buildscript {
        repositories {
            google()
            mavenCentral()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:8.2.2' //updated gradle
            classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.0" //updated kotlin version
    
            // NOTE: Do not place your application dependencies here; they belong
            // in the individual module build.gradle files
        }
    }
    
    task clean(type: Delete) {
        delete rootProject.buildDir
    }
    
    2. App level build.gradle update java version
    plugins {
        id 'com.android.application'
        id 'kotlin-android'
    }
    
    android {
        compileSdk 34
    
        defaultConfig {
            applicationId "com.test.test"
            minSdk 24
            targetSdk 34
            versionCode 1
            versionName "1.0"
    
            testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        }
    
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            }
        }
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_17
            targetCompatibility JavaVersion.VERSION_17
        }
        kotlinOptions {
            jvmTarget = JavaVersion.VERSION_17.toString()
        }
        buildFeatures {
            viewBinding true
        }
    
        namespace 'com.test.test'
    }
    
    dependencies {
        
         // ..... your other dependencies
    
    }
    
    3. Go to your project > gradle/wrapper/gradle-wrapper.properties

    update gradle version

    distributionBase=GRADLE_USER_HOME
    distributionPath=wrapper/dists
    distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
    validateDistributionUrl=true
    zipStoreBase=GRADLE_USER_HOME
    zipStorePath=wrapper/dists
    

    Make desired changes if you want to upgrade for higher version.

    And if you get any other error edit your question. Check this for more information

    https://kotlinlang.org/docs/releases.html#release-details


    AGP compatibility with Android Studio

    enter image description here

    Gradle plugin details - https://developer.android.com/build/releases/gradle-plugin#updating-gradle