https://kotlinlang.org logo
Title
m

mikehearn

03/08/2017, 9:20 AM
gradle will automatically bump up the stdlib to 1.1 if necessary to keep things consistent
👍 2
m

mg6maciej

03/08/2017, 12:38 PM
It will use the latest version, but will not bump automatically.
I have @nhaarman 's mockito-kotlin and I also needed to add
androidTestCompile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
testCompile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
Error:Conflict with dependency 'org.jetbrains.kotlin:kotlin-stdlib' in project ':app'. Resolved versions for app (1.1.0) and test app (1.0.6) differ. See http://g.co/androidstudio/app-test-app-conflict for details.
n

nhaarman

03/08/2017, 12:39 PM
@maciej still for 1.1.0?
m

mg6maciej

03/08/2017, 12:40 PM
I use 1.1.
n

nhaarman

03/08/2017, 12:40 PM
I have this, haven't tested without for 1.1.0:
configurations.all {
        resolutionStrategy {
            forcedModules = [kotlinStdLib,
                             kotlinReflect]
        }
    }
where the forcemodules version is 1.1.0-eap-x
If you want to see, just remove testCompile kotlin-reflect and try to run tests.
Not that I would want you to update your lib to 1.1. Just pointing to the issue I had (easily) resolved.
Note it's Android and Android is weird.
It will create two separate APKs for app and test code and can end up having different versions of dependencies in each, then it crashes.
That's the reason behind
exclude group: ...
and adding
kotlin-reflect:1.1
.
n

nhaarman

03/08/2017, 3:57 PM
@mg6maciej There are a couple of people who upvoted the pull request to update the Kotlin dependency for Mockito-Kotlin to 1.1.0, which is exactly why I'm asking ^^
m

mg6maciej

03/08/2017, 4:03 PM
Added a comment there.
Maybe will help someone who didn't figure it out for themselves.
n

nhaarman

03/08/2017, 4:06 PM
great!
so the build definitely fails for you if your don't add those lines, right? If that's the case, perhaps the best thing to do is indeed updating the dependency to to 1.1.0
m

mg6maciej

03/08/2017, 4:13 PM
I think it's a safe assumption. Unless you add a lot of features people can still use 1.3.0 with Kotlin 1.0.x.
If I had to guess, more than half Android projects globally are already on 1.1.
n

nhaarman

03/08/2017, 4:34 PM
yeah but that's a shame to the other half if it doesn't work, isn't it 😅