I try to run Kotlin instrumentation tests for android.
In my app/build.gradle:
android {
dataBinding {
enabled = true
For those who still have problems like this, This happens because Kotlin compiler wants to generate getter/setter properties. for example, I've got this error because I didn't mention @Rule annotation with @get:Rule.
If we annotate properties like this with @get:... or @JvmField it could solve the problem.
@get:Rule
var mActivityRule = ActivityTestRule(MainActivity::class.java)
Or
@Rule
@JvmField
var mActivityRule = ActivityTestRule(MainActivity::class.java)
@JvmField instructs the Kotlin compiler not to generate getters/setters for this property and expose it as a field.