Appium espresso failure - potential causes

Hi, I am attempting to get Espresso server running for a clients production application, however it is failing.

I have tried several ‘test/demo’ applications which work fine with both espresso driver and the compose sub-driver, however it is failing with the production app. I was hoping for someone to give me some potential candidates as to why the the espresso server would be failing to begin instrumentation.

Key factors:

  • The app it is failing against is significantly more complex (i.e not a demo or test app)
  • The espresso server is building and installing fine, its just failing to start instrumentation and sync with the app under test
  • I have tried syncing some of the primary dependencies and versions, but that didnt help

Relevant section of the logcat output (not particularly useful):

W ServiceManager: Permission failure: android.permission.HIGH_SAMPLING_RATE_SENSORS from
W ServiceManager: Permission failure: android.permission.HIGH_SAMPLING_RATE_SENSORS from D DebugPreferences$special$$inlined$value: Loaded preference country_code =
E AndroidJUnitRunner: An unhandled exception was thrown by the app.

…after this it brings down the instrumentation process and then complains about airship which may just be a side effect of the UnitRunner unhandled exception and not a root cause:

E MonitoringInstr: java.lang.IllegalStateException: Take off must be called before shared()
E MonitoringInstr: at com.urbanairship.UAirship.shared(

If anyone could just throw some suggestions as to what has the potential to cause this behaviour I would be very grateful.

Typically the developer will add the Espresso code to a debug build, not the production build. Could that be why it’s failing?

Oh sorry I was a bit misleading - it is actually debug build of the application. Not sure why I referred to it as a production app.

No worries. It was just confusing to me. I know very well the limitations of internet forum communications, so I always ask questions.

I don’t use Espresso, but I think it would be helpful to see the full log. Could you post it here as a Github Gist?

Thanks so much for your time, I actually ended up getting it working. It was actually just a dependency syncing issue.

For those who encounter this somewhat vague, unhandled exception in future, its as simple as working through the Appium and seeing the section on syncing dependencies within the espresso build config. Make sure they align with the dependencies in your app under test. For me, it was compileSdk and some androidx dependencies that was missing.

1 Like