UIAutomator2 server 3.1.1 - INSTRUMENTATION_RESULT: shortMsg=Process crashed . The instrumentation process has been unexpectedly terminated

I am getting the below error when upgraded the appium version from 1.7.2 to 1.10.0. It is observed in real devices. Any help will be really appreciated.

  • Appium version: 1.10.0
  • Desktop OS: macOS High Sierra 10.13.6
  • Mobile platform/version under test: Huwawei nova 3
  • Real device or emulator/simulator: Real Device
  • How Appium Installed : using npm

Error log is mentioned below -
[debug] e[35m[UiAutomator2]e[39m Performing shallow cleanup of automation leftovers
[debug] e[35m[ADB]e[39m Running ‘/Users/srafi/Library/Android/sdk/platform-tools/adb -P 5037 -s WCR0218604000762 shell am force-stop io.appium.uiautomator2.server.test’
e[35m[UiAutomator2]e[39m Starting UIAutomator2 server 3.1.1
e[35m[UiAutomator2]e[39m Using UIAutomator2 server from ‘/usr/local/lib/node_modules/appium/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-v3.1.1.apk’ and test from ‘/usr/local/lib/node_modules/appium/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-debug-androidTest.apk’
e[35m[UiAutomator2]e[39m Waiting up to 300000ms for UiAutomator2 to be online…
[debug] e[35m[ADB]e[39m Creating ADB subprocess with args: ["-P",5037,"-s",“WCR0218604000762”,“shell”,“am”,“instrument”,"-w",“io.appium.uiautomator2.server.test/androidx.test.runner.AndroidJUnitRunner”]
[debug] e[35m[Instrumentation]e[39m io.appium.uiautomator2.server.test.AppiumUiAutomator2Server:
[debug] e[35m[Instrumentation]e[39m INSTRUMENTATION_RESULT: shortMsg=Process crashed.
[debug] e[35m[Instrumentation]e[39m INSTRUMENTATION_CODE: 0
[debug] e[35m[Instrumentation]e[39m The process has exited with code 0
e[35m[UiAutomator2]e[39m The instrumentation process has been unexpectedly terminated. Retrying UiAutomator2 startup (#1 of 1)
[debug] e[35m[UiAutomator2]e[39m Performing strict cleanup of automation leftovers

Hey I got this issue resolved by factory resetting the affected devices. Now it starts working but there is a major delay before invoking the app to test.
Time took more than 3min to start the app invoking in the device.

This error is coming Randomly on devices. Please anyone could suggest a proper fix to resolve this issues
Mainly below things are noticed after the upgrade of appium from v1.7.2 to v1.10

  1. Randomly getting the mentioned error
    Exception upon trying to invoke the driver with App Capability ,so trying again
    16:49:27 [UiAutomator2] Error: The instrumentation process cannot be initialized. Make sure the application under test does not crash and investigate the logcat output.
    16:49:27 [UiAutomator2] at Object.wrappedLogger.errorAndThrow (/usr/local/lib/node_modules/appium/node_modules/appium-support/lib/logging.js:78:13)
    16:49:27 [UiAutomator2] at UiAutomator2Server.startSession (/usr/local/lib/node_modules/appium/node_modules/appium-uiautomator2-driver/lib/uiautomator2.js:196:13)
    16:49:27 [UiAutomator2] at

  2. Invoking the app/starting the session for test taking quite lot of time (more than 5 min for one device ) after the app installation.

Issue got fixed in Appium version v1.11.0

Hello Team,

I am getting this error while working on the Android Studio and Appium…

An unknown server-side error occurred while processing the command. Original error: The instrumentation process cannot be initialized. Make sure the application under test does not crash and investigate the logcat output.