Search code examples
androidfirebase-test-lab

Firebase Test Lab: ClassNotFoundException: Didn't find class "android.support.test.runner.AndroidJUnitRunner"


Tests pass when executed from command line, but not in Firebase Test Lab.

FATAL EXCEPTION: main
Process: io.app, PID: 8460
java.lang.RuntimeException: Unable to instantiate instrumentation ComponentInfo{io.app.test/android.support.test.runner.AndroidJUnitRunner}: 
java.lang.ClassNotFoundException: Didn't find class "android.support.test.runner.AndroidJUnitRunner" on path: DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/system/framework/android.test.mock.jar", zip file "/data/app/io.app.test-Lhy59NcEDyw4_BcWTLMjQw==/base.apk", zip file "/data/app/io.app-Pxsp6qUCO3AXUr6rsMhX1A==/base.apk"],nativeLibraryDirectories=[/system/lib, /system/vendor/lib]]

Solution

  • This happens when uploading the wrong androidTest APK to Firebase Test Lab. Use Android Studio to analyze the APK that you're uploading and check that classes.dex (or classes{i}.dex) has your tests.

    Your test APK might be in a different directory: inside the build/ folder of a different module.