1.

I Get An Error ‘resolved Versions For App (1.1.x) And Test App (1.0.x) Differ’. What Should I Do?

Answer»

Mockito-Kotlin depends on VERSION 1.0.x of Kotlin’s standard and reflect library. If you depend on 1.1.x, you may get this error. To solve this, add the following snippet to your ROOT’s build.gradle, REPLACING $kotlinVersion with the version your project uses:

subprojects {
configurations.all {
resolutionStrategy {
forcedModules = [
"org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion",
"org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion"
]
}
}
}

If you don’t want to FORCE dependencies LIKE this, you can alternatively depend on the newer version of kotlin-reflect explicitly, which will make Mockito-Kotlin use that version as well:

testCompile 'com.nhaarman:mockito-kotlin:x.x.x`
testCompile 'org.jetbrains.kotlin:kotlin-reflect:1.1.1'

Mockito-Kotlin depends on version 1.0.x of Kotlin’s standard and reflect library. If you depend on 1.1.x, you may get this error. To solve this, add the following snippet to your root’s build.gradle, replacing $kotlinVersion with the version your project uses:

subprojects {
configurations.all {
resolutionStrategy {
forcedModules = [
"org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion",
"org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion"
]
}
}
}

If you don’t want to force dependencies like this, you can alternatively depend on the newer version of kotlin-reflect explicitly, which will make Mockito-Kotlin use that version as well:

testCompile 'com.nhaarman:mockito-kotlin:x.x.x`
testCompile 'org.jetbrains.kotlin:kotlin-reflect:1.1.1'



Discussion

No Comment Found