Ewan
11/12/2020, 3:40 PMclass Person(val name: String) {
fun greeting() = "Hello, I'm $name"
}
I can run this test in Android Studio:
class ExampleUnitTest {
@Test
fun name() {
val person = Person("Jane")
assert(person.name == "Jane")
}
}
but...
If I set a non-suspending breakpoint to print out the value of person.name or a set a suspending breakpoint and use Evaluate Expression to evaluate person.name I get the error:
Class 'uk.co.telesense.controller.Person' is compiled by a new Kotlin compiler backend and cannot be loaded by the old compiler
If I debug the test with no breakpoints it runs green. Any idea what's going on here?
In the kotlin library I have:
compileKotlin {
kotlinOptions.useIR = true
}
compileTestKotlin {
kotlinOptions.useIR = true
}
in the Android Studio project I have
buildscript {
ext.kotlin_version = '1.4.10'
...
dependencies {
classpath 'com.android.tools.build:gradle:4.2.0-alpha15'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
...
}
I hope that makes sense! Any ideas?Zach Klippenstein (he/him) [MOD]
11/12/2020, 3:56 PMEwan
11/12/2020, 5:06 PM