When this happens for the Lint task, one can list the dependencies with:
./gradlew -q dependencies app:dependencies --configuration lintClassPath
Which shows that eg. kotlin-stdlib-jdk8:1.4.32
is being used:
+--- org.jetbrains.kotlin:kotlin-reflect:1.4.32 (*)
\--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.4.32 (*)
I've wrote a Gradle script, which equalizes all the Kotlin library versions:
// Runtime JAR files in the classpath should have the same version.
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def kotlinVersion = "1.6.0"
def requested = details.requested
if (requested.group == 'org.jetbrains.kotlin') {
List<String> list = ['kotlin-stdlib', 'kotlin-stdlib-jdk7', 'kotlin-stdlib-jdk8', 'kotlin-stdlib-common']
if (list.contains(requested.name)) { details.useVersion kotlinVersion }
}
}
}
There is no other way, because some older versions are being pulled in by build tools.
One likely could also add kotlin-reflect
into the List<String> list
(not tested).