deepu
deepu

Reputation: 73

Caused by: java.lang.NoSuchMethodError: No static method listOf(Ljava/lang/Object;)Ljava/util/List; in class Lk/v/i; or its super classes

I'm using kotlin collections library (listOf, first, toList, etc,..) methods in our AndroidTest package to run UI tests using AndroidJunit4 runner and I'm coming across these type of errors wherever I refer to kotlin collections library.

java.lang.NoSuchMethodError: No static method listOf(Ljava/lang/Object;)Ljava/util/List; in class Lk/v/i; or its super classes (declaration of 'k.v.i' appears 

The strange thing is I don't see any issues in Compile time nor when I run tests independently at the class level. The issue happens only when I run the whole test suite using Gradle

This is the command I use to run the UI test suite using Gradle

./gradlew connectedCheck --info --full-stacktrace --no-build-cache --debug

What I'm suspecting is the classes that get loaded during runtime seems to be different from compile time

Here's the build.gradle dependencies


    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.71"

    //  Instrumented Tests
    testImplementation "androidx.test:core:1.2.0"
    androidTestImplementation 'androidx.test.ext:junit:1.1.1' 
    androidTestImplementation 'androidx.test.ext:junit-ktx:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0' 
    

  defaultConfig {
    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
  }

Upvotes: 7

Views: 2946

Answers (0)

Related Questions