7

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"
  }

deepu
  • 73
  • 1
  • 4
  • Have you by any chance use Keeper plugin? https://github.com/slackhq/keeper Or just minimize your test apk with r8? If that's true, check r8(if forced not bundled agp version) and keeper version – Dmitriy Voronin Jul 15 '20 at 10:01

0 Answers0