How to Solve appium Startup Error (Various Error Messages)

The appium startup keeps reporting errors.
Various errors, such as.

[debug] [ADB] Creating ADB subprocess with args: ["-P",5037,"-s","192.168.0.4:5555","shell","am","instrument","-w","io.appium.uiautomator2.server.test/androidx.test.runner.AndroidJUnitRunner"]
[debug] [WD Proxy] Matched '/status' to command name 'getStatus'
[debug] [WD Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body
[WD Proxy] Got an unexpected response: {"errno":-4077,"code":"ECONNRESET","syscall":"read"}

or:

[debug] [ADB] Running 'D:\003-soft\android-sdk-windows\platform-tools\adb.exe -P 5037 -s 192.168.0.4\:5555 forward --remove tcp\:8200'
[UiAutomator2] Unable to remove port forward 'Error executing adbExec. Original error: 'Command 'D\:\\003-soft\\android-sdk-windows\\platform-tools\\adb.exe -P 5037 -s 192.168.0.4\:5555 forward --remove tcp\:8200' exited with code 1'; Stderr: 'error: listener 'tcp:8200' not found'; Code: '1''
[debug] [BaseDriver] Event 'newSessionStarted' logged at 1659668519002 (11:01:59 GMT+0800 (China Standard Time))

 

The appium.setting installed on the device doesn’t open manually either, and I always thought that was the reason.
Tried to re-install appium and node version, still not working. Finally, here is the solution below:

if automation_name =='UiAutomator2':
    desired_cap['uiautomator2ServerInstallTimeout'] = 20000 This time is changed from 9000 to 20000 and it's fine. It started successfully. After a week of problems, finally good.

Read More: