Skip to content

Commit 4fd93db

Browse files
iamjosephmjclaude
andcommitted
ci: add missing androidx.test:runner dep for AndroidJUnitRunner
Previous CI run got all the way through SDK install, KVM, emulator boot, APK install, and instrumentation start before failing with: java.lang.RuntimeException: Unable to instantiate instrumentation androidx.test.runner.AndroidJUnitRunner: java.lang.ClassNotFoundException: Didn't find class "androidx.test.runner.AndroidJUnitRunner" on path: DexPathList[...] In modern androidx.test versions, ext:junit and runner are separate artifacts. ext:junit ships AndroidJUnit4 + ApplicationProvider; runner ships the AndroidJUnitRunner class that testInstrumentationRunner references. Without the runner dep on the androidTest classpath the class is missing from the test APK and instrumentation start fails at test-run time — there's no compile-time check because testInstrumentationRunner is a string property. Add androidx.test:runner 1.6.2 (matches the other 1.6.x deps) to the version catalog and to androidTestImplementation. The catalog comment captures the failure mode so the gotcha is documented for future-me. :deviceintelligence:assembleDebugAndroidTest -> BUILD SUCCESSFUL. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent b56024b commit 4fd93db

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

deviceintelligence/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ dependencies {
182182
androidTestImplementation(libs.junit)
183183
androidTestImplementation(libs.androidx.test.ext.junit)
184184
androidTestImplementation(libs.androidx.test.core)
185+
androidTestImplementation(libs.androidx.test.runner)
185186
}
186187

187188
// AGP creates the `release` software component lazily during evaluation

gradle/libs.versions.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ junit = "4.13.2"
1616
# typically requires re-checking these.
1717
androidx-test-core = "1.6.1"
1818
androidx-test-ext-junit = "1.2.1"
19+
# AndroidJUnitRunner ships in androidx.test:runner — separate artifact
20+
# from ext.junit (which only ships AndroidJUnit4 + ApplicationProvider).
21+
# testInstrumentationRunner references the runner class by name; without
22+
# this dep on androidTest classpath, the instrumentation start fails with
23+
# ClassNotFoundException at test-run time, not at build time.
24+
androidx-test-runner = "1.6.2"
1925

2026
[libraries]
2127
kotlinx-coroutines-android = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-android", version.ref = "kotlinx-coroutines" }
@@ -24,6 +30,7 @@ androidx-lifecycle-runtime-ktx = { group = "androidx.lifecycle", name = "lifecyc
2430
junit = { group = "junit", name = "junit", version.ref = "junit" }
2531
androidx-test-core = { group = "androidx.test", name = "core", version.ref = "androidx-test-core" }
2632
androidx-test-ext-junit = { group = "androidx.test.ext", name = "junit", version.ref = "androidx-test-ext-junit" }
33+
androidx-test-runner = { group = "androidx.test", name = "runner", version.ref = "androidx-test-runner" }
2734

2835
[plugins]
2936
android-application = { id = "com.android.application", version.ref = "agp" }

0 commit comments

Comments
 (0)