4

I'm developing a small set of instrumented tests using JUnit and Espresso to automate the testing process of my activities and fragments, but I'm having some crashes in some devices.

The test suite runs fine on the Pixel 6 with API 31 and on the Pixel 3 with API 30. I chose those devices/APIs because I intend to run these tests in the Firebase Test Lab in the near future.

Running the same test suite in the Pixel 2 with API 29 throws the following exception while opening the activity on the first test:

W/Binder: Caught a RuntimeException from the binder stub implementation.
    java.lang.SecurityException: Calling from not trusted UID!
        at android.app.UiAutomationConnection.throwIfCalledByNotTrustedUidLocked(UiAutomationConnection.java:520)
        at android.app.UiAutomationConnection.shutdown(UiAutomationConnection.java:424)
        at android.app.IUiAutomationConnection$Stub.onTransact(IUiAutomationConnection.java:390)
        at android.os.Binder.execTransactInternal(Binder.java:1021)
        at android.os.Binder.execTransact(Binder.java:994)
    Outgoing transactions from this process must be FLAG_ONEWAY
    java.lang.Throwable
        at android.os.BinderProxy.transact(BinderProxy.java:480)
        at android.app.IInstrumentationWatcher$Stub$Proxy.instrumentationFinished(IInstrumentationWatcher.java:205)
        at com.android.server.am.InstrumentationReporter$MyThread.run(InstrumentationReporter.java:86)

Debugging my tests I can see that the error is thrown from the super.onCreate(savedInstanceState) line (first line of the activity's onCreate method). However, running the application in normal mode is working fine on that same device/API.

Has anyone seen this before? Am I missing something in my activity to make this work?

Daniel Schröder
  • 547
  • 4
  • 18
  • what do you mean "running the application in normal mode"? – Lino Feb 21 '23 at 14:22
  • @Lino I mean running a normal (debug or even release) build as an installed application on that same device. Android Studio > Build App > Install is working fine. No problems or crashes on the app whatsoever. It looks like it's something very specific about that device or API version. – Daniel Schröder Feb 23 '23 at 01:54

0 Answers0