selenium.common.exceptions.WebDriverException:An unknown server-side error occurred while processing the command. Original error: 'POST/appium/device/press_keycode' cannot be proxied to UiAutomator2 server because the instrumentation process is not runing

I am trying to reestablish the appium server once the device is rebooted within the testcase itself. But once the phone is rebooted, I get this in the logs
[Instrumentation] INSTRUMENTATION_ABORTED: System has crashed.
And I wont be able to perform any clicks using the driver, I get this error:
selenium.common.exceptions.WebDriverException:An unknown server-side error occurred while processing the command. Original error: ‘POST/appium/device/press_keycode’ cannot be proxied to UiAutomator2 server because the instrumentation process is not running(probably crashed). Check the server log and/or the logcat output for more details

Appium version? Looks like you may be trying to invoke a deprecated function.

Hi, I also observed this issue and managed to fix it by changing the driver.longPressKey() to something else.

KeyEvent event = new KeyEvent();
        event.withKey(AndroidKey.HOME);

        driver.longPressKey(event);

If it is a deprecated function that could fail the initialization process, why does the library still not flag it as deprecated or even make this method obsolete? At least for now, my IDE (IntelliJ) has not managed to flag it as deprecated.

My machine version:
Appium version: 2.11.3
Uiautomator2 driver version: [email protected]

You don’t say the language but it looks like Java. I checked the Java Client and don’t see any kind of depreciation notice:

I also took a look at all bugs open and closed and did not find any with keyword: longPressKey. If you can reproduce the issue, I would suggest filing a bug.