'How do I set a different kotlin version for flutter app? (I guess)

I'm using a flutter package "flutter_ironsource_x" to get ironsource ads showing in my app.

When attempting to build, I get an error as this:

Running Gradle task 'assembleDebug'...
e: C:/Users/myname/.gradle/caches/transforms-2/files-2.1/683fded33b117c0eb9bb9deabca1a71e/work-runtime-2.7.0-api.jar!/META-INF/work-runtime_release.kotlin_module: 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.

FAILURE: Build failed with an exception.

What went wrong:
Execution failed for task ':flutter_ironsource_x:compileDebugKotlin'.
Compilation error. See log for more details

I added these lines (buildscript) in my build.gradle afterwards, while changing the org.jetbrains.kotlin version in two places:

buildscript {
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:4.1.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.15"
    }
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.1.15"
    implementation 'androidx.multidex:multidex:2.0.1'
    implementation 'com.ironsource.sdk:mediationsdk:7.1.14'
}

Tho, on the buildscript part I have an yellow highlight on the kotlin line, which on hover says,

Kotlin version that is used for building with Gradle (1.1.15) differs from the one bundled into the IDE plugin (1.6.10) 

Could some help me out? Its been some while trying to get it to work. Any help is appreciated.



Solution 1:[1]

you can go to android/build.gradle and set the kotlin version to the latest one like this

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

dependencies {
    classpath 'com.android.tools.build:gradle:4.1.0'
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}

}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 billal kabbouri