Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conflict with dependency...Resolved versions for app (1.0.2) and test app (1.0.6) differ #146

Closed
sevar83 opened this issue Jan 6, 2017 · 5 comments

Comments

@sevar83
Copy link

sevar83 commented Jan 6, 2017

Kotlin 1.0.6
Android Studio 2.3.0-canary 3

testCompile "com.nhaarman:mockito-kotlin:1.1.0"

Error:Conflict with dependency 'org.jetbrains.kotlin:kotlin-stdlib' in project ':app'. Resolved versions for app (1.0.2) and test app (1.0.6) differ. See http:https://g.co/androidstudio/app-test-app-conflict for details.

@nhaarman
Copy link
Collaborator

nhaarman commented Jan 6, 2017

Mockito-Kotlin depends only on 1.0.6, so the dependency conflict should be on your side. Do you have any dependencies that depend on 1.0.2? If so, you can try using a ResolutionStrategy to force 1.0.6 on them.

@sevar83
Copy link
Author

sevar83 commented Jan 6, 2017

Do you have any dependencies that depend on 1.0.2?

I guess RxKotlin is the culprit. Could you tell me how to use ResolutionStrategy please?

@nhaarman
Copy link
Collaborator

nhaarman commented Jan 7, 2017

An easier way is to just depend on the stdlib yourself explicitly:

compile 'io.reactivex:rxkotlin:0.60.0'
compile "org.jetbrains.kotlin:kotlin-stdlib:1.0.6" // This overrides the 1.0.2 dependency in RxKotlin
testCompile  "com.nhaarman:mockito-kotlin:1.1.0"

Or, using a Resolution strategy:

dependencies {
    compile 'io.reactivex:rxkotlin:0.60.0'
    testCompile "com.nhaarman:mockito-kotlin:1.1.0"
}

configurations.all {
    resolutionStrategy {
        force 'org.jetbrains.kotlin:kotlin-stdlib:1.0.6'
    }
}

@nhaarman nhaarman closed this as completed Jan 7, 2017
@tasomaniac
Copy link

I had a very similar problem and I'm also familiar with this already but anyways I did it wrong. Posting here for others to find out if they have the same issue.

We are using kotlin-stdlib-jre7. That's why I was forcing that dependency to be the dependency I want. But they are of course not the same and resolutionStrategy.force just matches if they have the same group and the name.

So make sure that you are forcing kotlin-stdlib just like mentioned here.

@paulnunezm
Copy link

I've found a way to solve this issue using the following:
testCompile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"

Hope it works for you too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants