running-instrumented-tests-with-androidjunit4
Installation
SKILL.md
Running Instrumented Tests with AndroidJUnit4 — Get the Runner Stack Right
Instrumentation tests fail before any assertion runs when the runner stack is misconfigured: a deprecated AndroidJUnit4 import, the orchestrator on androidTestImplementation instead of androidTestUtil, the deprecated androidx.test.InstrumentationRegistry instead of androidx.test.platform.app.InstrumentationRegistry. This skill encodes the exact dependency matrix, the runner Gradle config, and the supporting annotations and rules.
When to use this skill
- The IDE flags
androidx.test.runner.AndroidJUnit4as@Deprecated, or the test compiles but emits the deprecation warning. am instrumentreturnsINSTRUMENTATION_FAILED: <pkg>/androidx.test.runner.AndroidJUnitRunnerorTest runner not found.- Test Orchestrator is configured in Gradle but tests still share a single instrumentation process (orchestrator silently disabled).
- The user passes
-e size small/-e package com.fooviaam instrumentand the test ignores it —RunnerArgsis unwired. - A test needs
ACCESS_FINE_LOCATION/RECORD_AUDIOetc. and the user is hand-rolling permission grants fromadb. - The user wants to skip a test below API 26 and is searching for the annotation.