Willis
01/08/2019, 12:22 PMUnresolved reference: mockK
error when building/executing the test even if InteliJ autocompletion finds the library without any problem 😕Sabrina Namur
01/08/2019, 12:59 PMJonas Bark
01/08/2019, 1:08 PMWillis
01/08/2019, 2:47 PMConflict with dependency 'org.jetbrains.kotlin:kotlin-reflect' in project ':app'. Resolved versions for app (1.3.11) and test app (1.3.0) differ. See <https://d.android.com/r/tools/test-apk-dependency-conflicts.html> for details.
Would Mockk not compatible with Kotlin 1.3.11?plugins {
id 'org.jetbrains.kotlin.multiplatform' version '1.3.11'
}
repositories {
google()
jcenter()
mavenCentral()
maven { url "<https://dl.bintray.com/kotlin/ktor>" }
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-multiplatform'
android {
compileSdkVersion 28
defaultConfig {
applicationId "org.jetbrains.kotlin.mpp_app_android"
minSdkVersion 15
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
}
kotlin {
targets {
fromPreset(presets.android, 'android')
// This preset is for iPhone emulator
// Switch here to presets.iosArm64 (or iosArm32) to build library for iPhone device
fromPreset(presets.iosX64, 'ios') {
compilations.main.outputKinds('FRAMEWORK')
}
}
sourceSets {
commonMain {
dependencies {
implementation 'org.jetbrains.kotlin:kotlin-stdlib-common:1.3.11'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core-common:1.1.0'
implementation 'io.ktor:ktor-client-core:1.1.1'
}
}
commonTest {
dependencies {
implementation 'org.jetbrains.kotlin:kotlin-test-common:1.3.11'
implementation 'org.jetbrains.kotlin:kotlin-test-annotations-common:1.3.11'
implementation "io.mockk:mockk-common:1.9"
implementation "io.mockk:mockk:1.9"
}
}
androidMain {
dependencies {
implementation 'org.jetbrains.kotlin:kotlin-stdlib'
implementation "io.ktor:ktor-client-android:1.1.1"
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.1.0'
}
}
androidTest {
dependencies {
implementation 'org.jetbrains.kotlin:kotlin-test'
implementation 'org.jetbrains.kotlin:kotlin-test-junit'
}
}
iosMain {
dependencies{
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core-native:1.1.0'
implementation 'io.ktor:ktor-client-core-native:1.1.1'
implementation 'io.ktor:ktor-client-ios:1.1.1'
}
}
iosTest {
}
}
}
Jonas Bark
01/08/2019, 2:49 PMWillis
01/08/2019, 3:00 PMconfigurations.all {
resolutionStrategy {
forcedModules = [
"org.jetbrains.kotlin:kotlin-reflect:1.3.11"
]
}
}
To the build gradle as well and now it’s working 🎉