uiautomator2ServerLaunchTimeout
Sometimes it takes too much time to launch uiAutomator2 . By default appium waits for 20000 ms. To make your script more stable you can use this capability.
Timeout in milliseconds used to wait for an uiAutomator2 server to launch. Defaults to 20000
capabilities.setCapability("uiautomator2ServerLaunchTimeout", 90000);