firebase-appdistribution-gradle incompatible with kotlin version

169 Views Asked by At

I built a gradle plugin to unify various behaviors across multiple modules. But, i'm having serious problems with the implementation of *firebase-appdistribution-gradle.
When gradle synchronizes I get this error:
C:/MyUsers/MyUser/.gradle/caches/modules-2/files-2.1/com.google.firebase/firebase-appdistribution-gradle/4.0.1/590333ca045bcfc61fd4e79ee08db449dcce604b/firebase-appdistribution-gradle-4.0.1.jar!/META-INF/appdistribution-gradle.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.8.0, expected version is 1.6.0.
I have Kotlin version 1.8.0 in the project but if I change it to 1.6.0 the error persists.
This is my implementation:

build.gradle.kts

plugins {
    `kotlin-dsl`
}

dependencies {
    compileOnly("com.android.tools.build", "gradle", "7.4.2")
    compileOnly("org.jetbrains.kotlin", "kotlin-gradle-plugin",
        "1.8.0"
    )
    compileOnly("com.google.firebase","firebase-appdistribution-gradle","4.0.1")
    compileOnly("com.google.firebase","firebase-crashlytics-gradle","2.9.9")
}

gradlePlugin {
    plugins {
        register("shared") {
            id = "my.android.dir.share"
            implementationClass = "SharedPlugin"
        }
    }
}

The mystery is that I also have an implementation on the main build.gradle like this:

buildscript {
    dependencies {
            classpath 'com.android.tools.build:gradle:7.4.2'
            classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.0"
        
            // App Distribution Gradle plugin
            classpath 'com.google.firebase:firebase-appdistribution-gradle:4.0.0'
        }
}

that works.
Thanks for your help

1

There are 1 best solutions below

0
On

It looks like you are encountering an issue with the compatibility of the Firebase App Distribution Gradle plugin and your Kotlin version. The error you are experiencing may be due to the fact that the Firebase App Distribution Gradle plugin version 4.0.1 is not compatible with Kotlin version 1.8.0.

plugins {
    `kotlin-dsl`
}

dependencies {
    compileOnly("com.android.tools.build", "gradle", "7.4.2")
    compileOnly("org.jetbrains.kotlin", "kotlin-gradle-plugin", "1.8.0")
    compileOnly("com.google.firebase", "firebase-appdistribution-gradle", "4.0.2") // Update to the latest compatible version
    compileOnly("com.google.firebase", "firebase-crashlytics-gradle", "2.9.9")
}

gradlePlugin {
    plugins {
        register("shared") {
            id = "my.android.dir.share"
            implementationClass = "SharedPlugin"
        }
    }
}