Spek: Error:Conflict kotlin-stdlib (1.1.2-5) and test app (1.0.6)

Created on 14 Jun 2017  路  3Comments  路  Source: spekframework/spek

Hi
I trying to use spek in android but I got the following error
Error:Conflict with dependency 'org.jetbrains.kotlin:kotlin-stdlib' in project ':app'. Resolved versions for app (1.1.2-5) and test app (1.0.6) differ. See http://g.co/androidstudio/app-test-app-conflict for details.
My Project gradle:

buildscript {
    ext.kotlin_version = '1.1.2-5'
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.3'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        maven { url "http://dl.bintray.com/jetbrains/spek" }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

My app gradle:

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'

android {
    compileSdkVersion 26
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "com.amorenew.calculator"
        minSdkVersion 17
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:26.0.0-alpha1'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    testCompile 'org.junit.jupiter:junit-jupiter-api:5.0.0-M4'
    testCompile 'org.junit.jupiter:junit-jupiter-engine:5.0.0-M4'
    testCompile 'org.jetbrains.spek:spek-api:1.1.2'
    testCompile 'org.jetbrains.spek:spek-junit-platform-engine:1.1.2'
    testCompile 'org.junit.platform:junit-platform-runner:1.0.0-M4'
    compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
}
repositories {
    mavenCentral()
}

Most helpful comment

Solved by

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

All 3 comments

I think this two line cause the problem but how could I fix it?

    testCompile 'org.jetbrains.spek:spek-api:1.1.2'
    testCompile 'org.jetbrains.spek:spek-junit-platform-engine:1.1.2'

Link in the error log has all the details to solve the issue https://sites.google.com/a/android.com/tools/tech-docs/new-build-system/user-guide#TOC-Resolving-conflicts-between-main-and-test-APK

Some of dependencies for your androidTestCompile configuration pull different version of Kotlin stud lib that app does, it doesn't look related to Spek

Solved by

configurations.all {
    resolutionStrategy {
        force 'org.jetbrains.kotlin:kotlin-stdlib:1.1.2-5'
    }
}
Was this page helpful?
0 / 5 - 0 ratings

Related issues

ddubson picture ddubson  路  7Comments

svenjacobs picture svenjacobs  路  6Comments

robstoll picture robstoll  路  7Comments

snowe2010 picture snowe2010  路  5Comments

ruigoncalo picture ruigoncalo  路  7Comments