With AGP 9.4.0, running one method from a JUnit4 @RunWith(Parameterized::class) instrumented test in Android Studio can finish with “0 tests” even though the method and parameter cases exist. This guide explains the documented filter-escaping regression, the fixed version, and safe temporary alternatives.
Representative result
0 tests
tests_regex "\[.*\]"
The symptom appears when an individual method is launched from the editor or context menu instead of running the entire parameterized class. The build may succeed while the test runner executes nothing.
Cause
Google Issue #558766788 states that, with AGP 9.4.0, the backslashes used to escape square brackets in the generated tests_regex are lost when the filter passes through the device shell. The resulting expression no longer matches JUnit4 parameterized test names, so the runner selects zero tests.
Affected and fixed versions: The regression is documented for AGP 9.4.0. Google lists its fix with Android Studio Rabbit 2 Canary 1 and AGP 9.5.0-alpha06, released September 17, 2026.
Trigger conditions
- The project uses Android Gradle Plugin 9.4.0.
- The target is an instrumented test on a device or emulator.
- The test uses the JUnit4 Parameterized runner.
- A single method is launched from Android Studio instead of the whole class.
- The run ends with zero tests rather than a normal assertion failure.
Recommended resolution
- Record the Android Studio, AGP, Gradle, and JDK versions.
- Upgrade to a compatible toolchain containing AGP 9.5.0-alpha06 or later. If previews are not allowed, use a later stable release confirmed to contain the fix.
- Match the Gradle wrapper and JDK to the official AGP compatibility requirements.
- Run Gradle Sync and launch the individual method again.
- Confirm that every expected parameterized case is executed.
Alternatives when you cannot update
Run the entire parameterized test class instead of one method; this may avoid the affected tests_regex path. Temporarily narrowing the data set in test code, or invoking the instrumented-test task at class scope, can also help isolate the needed cases.
These are temporary approaches, not the officially confirmed permanent fix. A green run with zero executed tests provides no validation, so always check the count and generated XML results.
How to verify the fix
- Run the full parameterized class and record the expected number of cases.
- Launch only the affected method from Android Studio.
- Confirm that its parameterized instances are discovered and run.
- Check the Run window and Gradle test-result XML to ensure the count is not zero.
Cautions
- Zero tests for ordinary JUnit4 tests, non-parameterized tests, or full-class runs may have another cause.
- Incorrect
@RunWith, test annotations, or instrumentation runner configuration can also produce zero tests. - Before changing AGP, verify compatibility with the project’s Gradle, JDK, and Android Studio versions.
Summary
AGP 9.4.0 can run zero tests when Android Studio launches a single method from a JUnit4 Parameterized instrumented test because backslashes are lost from tests_regex in the device shell. The documented fix is AGP 9.5.0-alpha06. Until the toolchain can be updated, run the full class and verify the executed-test count.
