appium-espresso-driver
appium-espresso-driver copied to clipboard
Source document generation throws exception
Espresso can't generate the source document
java.lang.NoSuchFieldException: INJECT_INPUT_EVENT_MODE_ASYNC\n\tat androidx.test.espresso.base.InputManagerEventInjectionStrategy.initialize(InputManagerEventInjectionStrategy.java:105)\n\tat androidx.test.espresso.base.BaseLayerModule.provideEventInjector(BaseLayerModule.java:132)\n\tat androidx.test.espresso.base.BaseLayerModule_ProvideEventInjectorFactory.proxyProvideEventInjector(BaseLayerModule_ProvideEventInjectorFactory.java:30)\n\tat androidx.test.espresso.base.BaseLayerModule_ProvideEventInjectorFactory.provideInstance(BaseLayerModule_ProvideEventInjectorFactory.java:21)\n\tat androidx.test.espresso.base.BaseLayerModule_ProvideEventInjectorFactory.get(BaseLayerModule_ProvideEventInjectorFactory.java:17)\n\tat androidx.test.espresso.base.BaseLayerModule_ProvideEventInjectorFactory.get(BaseLayerModule_ProvideEventInjectorFactory.java:7)\n\tat androidx.test.espresso.core.internal.deps.dagger.internal.DoubleCheck.get(DoubleCheck.java:51)\n\tat androidx.test.espresso.base.UiControllerImpl_Factory.provideInstance(UiControllerImpl_Factory.java:57)\n\tat androidx.test.espresso.base.UiControllerImpl_Factory.get(UiControllerImpl_Factory.java:40)\n\tat androidx.test.espresso.base.UiControllerImpl_Factory.get(UiControllerImpl_Factory.java:8)\n\tat androidx.test.espresso.core.internal.deps.dagger.internal.DoubleCheck.get(DoubleCheck.java:51)\n\tat androidx.test.espresso.base.UiControllerModule_ProvideUiControllerFactory.provideInstance(UiControllerModule_ProvideUiControllerFactory.java:28)\n\tat androidx.test.espresso.base.UiControllerModule_ProvideUiControllerFactory.get(UiControllerModule_ProvideUiControllerFactory.java:23)\n\tat androidx.test.espresso.base.UiControllerModule_ProvideUiControllerFactory.get(UiControllerModule_ProvideUiControllerFactory.java:9)\n\tat androidx.test.espresso.core.internal.deps.dagger.internal.DoubleCheck.get(DoubleCheck.java:51)\n\tat androidx.test.espresso.DaggerBaseLayerComponent$ViewInteractionComponentImpl.viewInteraction(DaggerBaseLayerComponent.java:295)\n\tat androidx.test.espresso.Espresso.onView(Espresso.java:75)\n\tat io.appium.espressoserver.lib.viewaction.ViewGetter.getRootView(ViewGetter.java:79)\n\tat io.appium.espressoserver.lib.model.SourceDocument.toStream(SourceDocument.java:215)\n\tat io.appium.espressoserver.lib.model.SourceDocument.toXMLString(SourceDocument.java:273)\n\tat io.appium.espressoserver.lib.handlers.Source.handle(Source.java:30)\n\tat io.appium.espressoserver.lib.handlers.Source.handle(Source.java:25)\n\tat io.appium.espressoserver.lib.http.Router.route(Router.java:325)\n\tat io.appium.espressoserver.lib.http.Server.serve(Server.java:69)\n\tat fi.iki.elonen.NanoHTTPD$HTTPSession.execute(NanoHTTPD.java:945)\n\tat fi.iki.elonen.NanoHTTPD$ClientHandler.run(NanoHTTPD.java:192)\n\tat java.lang.Thread.run(Thread.java:764)\nCaused by: java.lang.NoSuchFieldException: INJECT_INPUT_EVENT_MODE_ASYNC\n\tat java.lang.Class.getField(Class.java:1601)\n\tat androidx.test.espresso.base.InputManagerEventInjectionStrategy.initialize(InputManagerEventInjectionStrategy.java:89)\n\t... 26 more\n"}},"jsonwire-error":{"detail":"An unknown server-side error occurred while processing the command.","status":13,"summary":"UnknownError"},"message":"[source()] Error response status: 13, , UnknownError - An unknown server-side error occurred while processing the command. Selenium error: An unknown server-side error occurred while processing the command. Original error: java.lang.RuntimeException: java.lang.NoSuchFieldException: INJECT_INPUT_EVENT_MODE_ASYNC\n\tat androidx.test.espresso.base.InputManagerEventInjectionStrategy.initialize(InputManagerEventInjectionStrategy.java:105)\n\tat androidx.test.espresso.base.BaseLayerModule.provideEventInjector(BaseLayerModule.java:132)\n\tat androidx.test.espresso.base.BaseLayerModule_ProvideEventInjectorFactory.proxyProvideEventInjector(BaseLayerModule_ProvideEventInjectorFactory.java:30)\n\tat androidx.test.espresso.base.BaseLayerModule_ProvideEventInjectorFactory.provideInstance(BaseLayerModule_ProvideEventInjectorFactory.java:21)\n\tat androidx.test.espresso.base.BaseLayerModule_ProvideEventInjectorFactory.get(BaseLayerModule_ProvideEventInjectorFactory.java:17)\n\tat androidx.test.espresso.base.BaseLayerModule_ProvideEventInjectorFactory.get(BaseLayerModule_ProvideEventInjectorFactory.java:7)\n\tat androidx.test.espresso.core.internal.deps.dagger.internal.DoubleCheck.get(DoubleCheck.java:51)\n\tat androidx.test.espresso.base.UiControllerImpl_Factory.provideInstance(UiControllerImpl_Factory.java:57)\n\tat androidx.test.espresso.base.UiControllerImpl_Factory.get(UiControllerImpl_Factory.java:40)\n\tat androidx.test.espresso.base.UiControllerImpl_Factory.get(UiControllerImpl_Factory.java:8)\n\tat androidx.test.espresso.core.internal.deps.dagger.internal.DoubleCheck.get(DoubleCheck.java:51)\n\tat androidx.test.espresso.base.UiControllerModule_ProvideUiControllerFactory.provideInstance(UiControllerModule_ProvideUiControllerFactory.java:28)\n\tat androidx.test.espresso.base.UiControllerModule_ProvideUiControllerFactory.get(UiControllerModule_ProvideUiControllerFactory.java:23)\n\tat androidx.test.espresso.base.UiControllerModule_ProvideUiControllerFactory.get(UiControllerModule_ProvideUiControllerFactory.java:9)\n\tat androidx.test.espresso.core.internal.deps.dagger.internal.DoubleCheck.get(DoubleCheck.java:51)\n\tat androidx.test.espresso.DaggerBaseLayerComponent$ViewInteractionComponentImpl.viewInteraction(DaggerBaseLayerComponent.java:295)\n\tat androidx.test.espresso.Espresso.onView(Espresso.java:75)\n\tat io.appium.espressoserver.lib.viewaction.ViewGetter.getRootView(ViewGetter.java:79)\n\tat io.appium.espressoserver.lib.model.SourceDocument.toStream(SourceDocument.java:215)\n\tat io.appium.espressoserver.lib.model.SourceDocument.toXMLString(SourceDocument.java:273)\n\tat io.appium.espressoserver.lib.handlers.Source.handle(Source.java:30)\n\tat io.appium.espressoserver.lib.handlers.Source.handle(Source.java:25)\n\tat io.appium.espressoserver.lib.http.Router.route(Router.java:325)\n\tat io.appium.espressoserver.lib.http.Server.serve(Server.java:69)\n\tat fi.iki.elonen.NanoHTTPD$HTTPSession.execute(NanoHTTPD.java:945)\n\tat fi.iki.elonen.NanoHTTPD$ClientHandler.run(NanoHTTPD.java:192)\n\tat java.lang.Thread.run(Thread.java:764)\nCaused by: java.lang.NoSuchFieldException: INJECT_INPUT_EVENT_MODE_ASYNC\n\tat java.lang.Class.getField(Class.java:1601)\n\tat androidx.test.espresso.base.InputManagerEventInjectionStrategy.initialize(InputManagerEventInjectionStrategy.java:89)\n\t... 26 more\n","status":13}
This exception happens inside Espresso system lib: https://github.com/android/android-test/blob/7c8e582d18fa446920d5a3968b80056b796ce8bd/espresso/core/java/androidx/test/espresso/base/InputManagerEventInjectionStrategy.java#L83. Also, it would be interesting to know what Android version it is
Happening on Android Pie
When I choose an Emulator from AVD manager with an API level of P the error happens. When the API level is 28 it does not happen. I think this is probably an Emulator bug.
How is that possible I thought that Android P == API level 28
I don't know. But in the AVD manager it lists the version as P for some and 28 for others. I can screencap it if needed.
And to clarify, the Emulators that have the name P have the problem, the emulators that have the name 28 do work.
Closing this. Pretty sure it's just outdated Android P images that have this problem.
Happening on Android Q beta emulators. Will re-open just to keep track of it.