TestKase
TestKase
|Docs
AutomateMobileEspresso

Troubleshooting

The Espresso messages you are most likely to meet — Android 17 and older Espresso, suite/app mismatch, missing instrumentation, unknown devices, zero tests, timeouts — and what to do about each.

Each heading is the message, or the symptom, you will see.

Every view interaction fails on Android 17 with NoSuchMethodException

Every test that touches a view fails on an Android 17 device, with a stack like:

java.lang.NoSuchMethodException: android.hardware.input.InputManager.getInstance []

while the same suite passes on Android 16 and older.

Cause. Seen with Espresso 3.6.1 on Android 17. Espresso calls an internal Android API that Android 17 removed. The failure is inside Espresso, not in your tests or on our devices.

Fix. Use an Espresso / androidx.test release that supports Android 17 (check the androidx.test release notes), or leave Android 17 devices out of the build until you upgrade.

"This test suite was built for X, but the app is Y."

400 SUITE_APP_MISMATCH from POST /espresso/v1/build. The test suite's <instrumentation> targets package X, and the app you passed is package Y.

Common causes:

  • A build variant or flavour with an applicationIdSuffix (com.acme.staging) paired with a test APK from another variant. Build both from the same variant: assemble<Variant> and assemble<Variant>AndroidTest.
  • An old app or testSuite URL left in a CI variable. Upload both on every run.

The APK is refused at upload

  • "This APK is a test suite (it declares <instrumentation>)…" — you sent the androidTest APK to /app. Send it to /test-suite.
  • "This APK declares no <instrumentation>, so it is not a test suite…" — you sent the app to /test-suite. Send the -androidTest.apk file there.
  • "This test APK declares more than one <instrumentation>…" — a build runs exactly one instrumentation. Build a test APK with one.
  • UNSUPPORTED_FILE_TYPE — the filename must end in .apk. Upload a single universal .apk (not .aab or .apks).
  • 415 "Send the APK as multipart/form-data field file." — send the file as a multipart upload (curl -F "file=@…"). There is no upload by URL.

"The test suite's instrumentation was not found on the device."

A device ended error with this message. Both APKs installed, but the phone does not list your test runner for your app. Check that:

  • the test APK was built for this app — its targetPackage must be the app's package, and
  • testInstrumentationRunner in your build.gradle is set (normally androidx.test.runner.AndroidJUnitRunner).

"We couldn't install your app or test suite on the device."

Both APKs must be installable and signed with the same key. Gradle's debug builds are, by default. If you sign release or CI builds yourself, sign the test APK with the same key.

Two related messages:

  • "Your app needs a newer Android version than this device has." — the device is below your minSdkVersion. Pick a newer one.
  • "Your app has no native libraries for this device's CPU." — your APK has no native code for the device's ABI, which is common on emulators. Pick another device, or build for that ABI.

"No Android device matches: …"

400 UNKNOWN_DEVICE from POST /espresso/v1/build, listing every name we didn't recognise. Device names must match ours exactly, as "<device name>-<Android version>", for example "Pixel 8-17" (device names and Android versions vary — copy them from the capability generator).

Check the capability generator for the current list. For an emulator, send { "device": "…", "virtual": true }, and check the generator's Device type switch: a model can exist as a real phone, an emulator, or both.

"No device host that can run Espresso has a matching device right now."

A device ended error with this message. The device you asked for exists, but none of the machines holding one can run Espresso at the moment. Pick another device, or retry later.

"All matching Android devices are in use (…)"

Every matching phone stayed busy for longer than maxQueueWaitSeconds. Retry, choose a model with more devices (emulators usually have more), or raise maxQueueWaitSeconds.

"No tests matched the build's filters."

The run finished without a single test running, so the device is error. Check your filters:

  • class is the fully qualified name, com.acme.LoginTest, or com.acme.LoginTest#methodName for one method.
  • package and annotation are fully qualified too: com.acme.Smoke, not Smoke.
  • size matches only tests annotated @SmallTest, @MediumTest or @LargeTest.
  • Filters combine, so class plus annotation runs only tests that match both.

Without any filter, a suite with no tests in it gives the same result.

A device ends timedout

The run went past its runTimeout (or the 120-minute ceiling if you set none). Installing the APKs counts towards that time.

Common causes: a test waiting on something that never happens, a long Thread.sleep, or a suite that is simply too long for one device. Raise runTimeout (up to 120), split the suite across builds with filters, or fix the waiting test. Look at the last test's video to see where it stopped.

"The test run crashed on the device before it finished."

Your app or the test process crashed. The test that was running is failed, and the tests after it did not run. Open the session's crash dump and device log (GET /espresso/v1/builds/<id>/sessions/<sid>, or the Logs tab in the dashboard) for the stack trace.

"The device disconnected during the test run."

We lost the phone mid-run. This is on our side. Retry the build.

A build URL stopped working: "App farm://app-… was not found in your organization or has expired"

Uploads last 90 days, and when a library is full the oldest upload made through /espresso/v1 is replaced. Either way the old URL is gone. Upload the APK again and use the new URL — see Uploading APKs.

The All Commands tab is empty, or missing steps

  • Only actions and checks made through Espresso's onView() and onData() are listed. UiAutomator calls, or direct calls on views or your app's code, are not.
  • The list is read from the device log. With deviceLogs: false there is nothing to read.