3

I am getting the following errors when running flutter build apk in Windows (using VSCode)

The binary version of its metadata is 1.8.0, expected version is 1.6.0.

enter image description here

However, in my build.gradle, I have:

buildscript {
    ext.kotlin_version = '1.7.10'
    repositories {
        google()
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:7.2.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:4.3.15'

        classpath 'com.google.firebase:firebase-crashlytics-gradle:2.8.1'
    }
}

Really confused! Why is it not using Kotlin 1.7.10 (error suggests it's using 1.6.0?) and why is it then trying to use libraries that require 1.8.0?

EDIT:

I should have said that I did try the obvious top question related to this on Stack before asking this question:

Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.15

And I did try the top-rated (non-accepted) answer to this:

https://stackoverflow.com/a/74425347/187030

But this has not solved the problem for me.

I would also say this used to work (I have all the prerequisites installed from here, and flutter doctor is all green ticks)

I am probably doing something really n00by here as I'm a Windows .Net developer and I appreciate Flutter is wrapping a toolchain that I am not at all familiar with... but I'd really like to understand why I'm getting this problem and how to diagnose a solution for it....

Also, worth saying it does create the APK despite the errors, and, weirdly, if I build the apk with debug, then I don't get these errors:

flutter build apk <-- builds with errors ❌

flutter build apk --debug <-- builds without errors ✅

flutter build appbundle <-- builds without errors ✅

Kram
  • 4,099
  • 4
  • 39
  • 60
  • Does this answer your question? [Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.15](https://stackoverflow.com/questions/67699823/module-was-compiled-with-an-incompatible-version-of-kotlin-the-binary-version-o) – Robert Sandberg May 15 '23 at 19:57
  • Also read the top not accepted answer. – Robert Sandberg May 15 '23 at 19:58
  • Nope I did look at that in my searchings... I did also follow all of the steps in clearing caches etc. in the top non-accepted answer but to no avail. – Kram May 16 '23 at 09:01
  • I've been having the same issue when compiling to an APK target, but not when compilling an App Bundle. Interesting. – Klemen Tusar Jul 07 '23 at 09:56

0 Answers0