[UiAutomator2] The instrumentation process cannot be initialized within 30000ms timeout

Hello

When I tried to run any python test script on my computer, I encounter the error below.
I use the appium server windows version locally.
I looked with the security of my company and nothing is blocked at the firewall level.

Appium server log

[Appium] Appium v1.17.1 creating new AndroidUiautomator2Driver (v1.44.2) session
[BaseDriver] W3C capabilities and MJSONWP desired capabilities were provided
[BaseDriver] Creating session with W3C capabilities: {
[BaseDriver]   "alwaysMatch": {
[BaseDriver]     "platformName": "Android",
[BaseDriver]     "appium:platformVersion": "6.0",
[BaseDriver]     "appium:deviceName": "LG H815",
[BaseDriver]     "appium:app": "C:\\Users\\myusername\\Downloads\\sample-code-master\\sample-code\\apps\\ApiDemos\\bin\\ApiDemos-debug.apk"
[BaseDriver]   },
[BaseDriver]   "firstMatch": [
[BaseDriver]     {}
[BaseDriver]   ]
[BaseDriver] }
[BaseDriver] Session created with session id: 6f2f5b5e-74bb-4065-8999-3787332b66dd
[BaseDriver] Using local app 'C:\Users\myusername\Downloads\sample-code-master\sample-code\apps\ApiDemos\bin\ApiDemos-debug.apk'
[UiAutomator2] Checking whether app is actually present
[ADB] Using 'adb.exe' from 'C:\Android\Sdk\platform-tools\adb.exe'
[AndroidDriver] Retrieving device list
[ADB] Trying to find a connected android device
[ADB] Getting connected devices...
[ADB] Connected devices: [{"udid":"LGHxxxxxx","state":"device"}]
[AndroidDriver] Looking for a device with Android '6.0.0'
[ADB] Setting device id to LGHxxxxxx
[ADB] Getting device platform version
[ADB] Running 'C:\Android\Sdk\platform-tools\adb.exe -P 5037 -s LGHxxxxxx shell getprop ro.build.version.release'
[ADB] Current device property 'ro.build.version.release': 6.0
[AndroidDriver] Using device: LGHxxxxxx
[ADB] Using 'adb.exe' from 'C:\Android\Sdk\platform-tools\adb.exe'
[ADB] Setting device id to LGHxxxxxx
[ADB] Running 'C:\Android\Sdk\platform-tools\adb.exe -P 5037 -s LGHxxxxxx shell getprop ro.build.version.sdk'
[ADB] Current device property 'ro.build.version.sdk': 23
[ADB] Device API level: 23
[AndroidDriver] Parsing package and activity from app manifest
[ADB] Package name: 'io.appium.android.apis'
[ADB] Main activity name: 'ApiDemos'
[AndroidDriver] Parsed package and activity are: io.appium.android.apis/ApiDemos
[ADB] Running 'C:\Android\Sdk\platform-tools\adb.exe -P 5037 -s LGHxxxxxx wait-for-device'
[ADB] Running 'C:\Android\Sdk\platform-tools\adb.exe -P 5037 -s LGHxxxxxx shell echo ping'
[AndroidDriver] Pushing settings apk to device...
[ADB] Getting install status for io.appium.settings
[ADB] Running 'C:\Android\Sdk\platform-tools\adb.exe -P 5037 -s LGHxxxxxx shell dumpsys package io.appium.settings'
[ADB] 'io.appium.settings' is installed
[ADB] Getting package info for 'io.appium.settings'
[ADB] Running 'C:\Android\Sdk\platform-tools\adb.exe -P 5037 -s LGHxxxxxx shell dumpsys package io.appium.settings'
[ADB] The version name of the installed 'io.appium.settings' is greater or equal to the application version name ('3.1.0' >= '3.1.0')
[ADB] There is no need to install/upgrade 'C:\Program Files\Appium\resources\app\node_modules\appium\node_modules\io.appium.settings\apks\settings_apk-debug.apk'
[ADB] Getting IDs of all 'io.appium.settings' processes
[ADB] Running 'C:\Android\Sdk\platform-tools\adb.exe -P 5037 -s LGHxxxxxx shell 'pgrep --help; echo $?''
[ADB] Running 'C:\Android\Sdk\platform-tools\adb.exe -P 5037 -s LGHxxxxxx shell pgrep -f io\\.appium\\.settings'
[AndroidDriver] Granting permissions SET_ANIMATION_SCALE,CHANGE_CONFIGURATION,ACCESS_FINE_LOCATION to 'io.appium.settings'
[ADB] Granting permissions ["android.permission.SET_ANIMATION_SCALE","android.permission.CHANGE_CONFIGURATION","android.permission.ACCESS_FINE_LOCATION"] to 'io.appium.settings'
[ADB] Got the following command chunks to execute: [["pm","grant","io.appium.settings","android.permission.SET_ANIMATION_SCALE",";","pm","grant","io.appium.settings","android.permission.CHANGE_CONFIGURATION",";","pm","grant","io.appium.settings","android.permission.ACCESS_FINE_LOCATION",";"]]
[ADB] Running 'C:\Android\Sdk\platform-tools\adb.exe -P 5037 -s LGHxxxxxx shell pm grant io.appium.settings android.permission.SET_ANIMATION_SCALE \; pm grant io.appium.settings android.permission.CHANGE_CONFIGURATION \; pm grant io.appium.settings android.permission.ACCESS_FINE_LOCATION \;'
[ADB] Getting IDs of all 'io.appium.settings' processes
[ADB] Running 'C:\Android\Sdk\platform-tools\adb.exe -P 5037 -s LGHxxxxxx shell pgrep -f io\\.appium\\.settings'
[ADB] Starting Appium Settings app
[ADB] Running 'C:\Android\Sdk\platform-tools\adb.exe -P 5037 -s LGHxxxxxx shell am start -n io.appium.settings/.Settings -a android.intent.action.MAIN -c android.intent.category.LAUNCHER'
[ADB] Getting IDs of all 'io.appium.settings' processes
[ADB] Running 'C:\Android\Sdk\platform-tools\adb.exe -P 5037 -s LGHxxxxxx shell pgrep -f io\\.appium\\.settings'
[ADB] Running 'C:\Android\Sdk\platform-tools\adb.exe -P 5037 -s LGHxxxxxx shell appops set io.appium.settings android\:mock_location allow'
[Logcat] Starting logcat capture
[UiAutomator2] Forwarding UiAutomator2 Server port 6790 to 8200
[ADB] Forwarding system: 8200 to device: 6790
[ADB] Running 'C:\Android\Sdk\platform-tools\adb.exe -P 5037 -s LGHxxxxxx forward tcp\:8200 tcp\:6790'
[UiAutomator2] Server package at 'C:\Program Files\Appium\resources\app\node_modules\appium\node_modules\appium-uiautomator2-server\apks\appium-uiautomator2-server-v4.5.5.apk' is not writeable. Will copy it into the temporary location at 'C:\Users\myusername\AppData\Local\Temp\2020524-14784-q02w5q.80gig' as a workaround. Consider making this file writeable manually in order to improve the performance of session startup.
[ADB] Getting install status for io.appium.uiautomator2.server
[ADB] Running 'C:\Android\Sdk\platform-tools\adb.exe -P 5037 -s LGHxxxxxx shell dumpsys package io.appium.uiautomator2.server'
[ADB] 'io.appium.uiautomator2.server' is installed
[ADB] Getting package info for 'io.appium.uiautomator2.server'
[ADB] Running 'C:\Android\Sdk\platform-tools\adb.exe -P 5037 -s LGHxxxxxx shell dumpsys package io.appium.uiautomator2.server'
[ADB] The version name of the installed 'io.appium.uiautomator2.server' is greater or equal to the application version name ('4.5.5' >= '4.5.5')
[UiAutomator2] io.appium.uiautomator2.server installation state: sameVersionInstalled
[ADB] Checking app cert for C:\Users\myusername\AppData\Local\Temp\2020524-14784-q02w5q.80gig\appium-uiautomator2-server-v4.5.5.apk
[ADB] Using 'apksigner.jar' from 'C:\Android\Sdk\build-tools\30.0.0\lib\apksigner.jar'
[ADB] Starting apksigner: 'C:\\Program Files\\Java\\jdk-10.0.2\\bin\\java.exe' -Xmx1024M -Xss1m -jar C:\\\Android\\Sdk\\build-tools\\30.0.0\\lib\\apksigner.jar verify --print-certs C:\\Users\\myusername\\AppData\\Local\\Temp\\2020524-14784-q02w5q.80gig\\appium-uiautomator2-server-v4.5.5.apk
[ADB] apksigner stdout: Signer #1 certificate DN: [email protected], CN=Android, OU=Android, O=Android, L=Mountain View, ST=California, C=US
[ADB] Signer #1 certificate SHA-256 digest: a40da80a59d170caa950cf15c18c454d47a39b26989d8b640ecd745ba71bf5dc
[ADB] Signer #1 certificate SHA-1 digest: 61ed377e85d386a8dfee6b864bd85b0bfaa5af81
[ADB] Signer #1 certificate MD5 digest: e89b158e4bcf988ebd09eb83f5378e87
[ADB] 
[ADB] 'C:\Users\myusername\AppData\Local\Temp\2020524-14784-q02w5q.80gig\appium-uiautomator2-server-v4.5.5.apk' is signed with the default certificate
[ADB] Getting install status for io.appium.uiautomator2.server.test
[ADB] Running 'C:\Android\Sdk\platform-tools\adb.exe -P 5037 -s LGHxxxxxx shell dumpsys package io.appium.uiautomator2.server.test'
[ADB] 'io.appium.uiautomator2.server.test' is installed
[ADB] Checking app cert for C:\Program Files\Appium\resources\app\node_modules\appium\node_modules\appium-uiautomator2-server\apks\appium-uiautomator2-server-debug-androidTest.apk
[ADB] Starting apksigner: 'C:\\Program Files\\Java\\jdk-10.0.2\\bin\\java.exe' -Xmx1024M -Xss1m -jar C:\\\Android\\Sdk\\build-tools\\30.0.0\\lib\\apksigner.jar verify --print-certs 'C:\\Program Files\\Appium\\resources\\app\\node_modules\\appium\\node_modules\\appium-uiautomator2-server\\apks\\appium-uiautomator2-server-debug-androidTest.apk'
[ADB] apksigner stdout: Signer #1 certificate DN: [email protected], CN=Android, OU=Android, O=Android, L=Mountain View, ST=California, C=US
[ADB] Signer #1 certificate SHA-256 digest: a40da80a59d170caa950cf15c18c454d47a39b26989d8b640ecd745ba71bf5dc
[ADB] Signer #1 certificate SHA-1 digest: 61ed377e85d386a8dfee6b864bd85b0bfaa5af81
[ADB] Signer #1 certificate MD5 digest: e89b158e4bcf988ebd09eb83f5378e87
[ADB] 
[ADB] 'C:\Program Files\Appium\resources\app\node_modules\appium\node_modules\appium-uiautomator2-server\apks\appium-uiautomator2-server-debug-androidTest.apk' is signed with the default certificate
[UiAutomator2] Server packages are not going to be (re)installed
[UiAutomator2] Waiting up to 30000ms for services to be available
[ADB] Running 'C:\Android\Sdk\platform-tools\adb.exe -P 5037 -s LGHxxxxxx shell pm list instrumentation'
[UiAutomator2] Instrumentation target 'io.appium.uiautomator2.server.test/androidx.test.runner.AndroidJUnitRunner' is available
[ADB] Checking app cert for C:\Users\myusername\Downloads\sample-code-master\sample-code\apps\ApiDemos\bin\ApiDemos-debug.apk
[ADB] Starting apksigner: 'C:\\Program Files\\Java\\jdk-10.0.2\\bin\\java.exe' -Xmx1024M -Xss1m -jar C:\\\Android\\Sdk\\build-tools\\30.0.0\\lib\\apksigner.jar verify --print-certs C:\\Users\\myusername\\Downloads\\sample-code-master\\sample-code\\apps\\ApiDemos\\bin\\ApiDemos-debug.apk
[ADB] apksigner stdout: Signer #1 certificate DN: [email protected], CN=Android, OU=Android, O=Android, L=Mountain View, ST=California, C=US
[ADB] Signer #1 certificate SHA-256 digest: a40da80a59d170caa950cf15c18c454d47a39b26989d8b640ecd745ba71bf5dc
[ADB] Signer #1 certificate SHA-1 digest: 61ed377e85d386a8dfee6b864bd85b0bfaa5af81
[ADB] Signer #1 certificate MD5 digest: e89b158e4bcf988ebd09eb83f5378e87
[ADB] 
[ADB] 'C:\Users\myusername\Downloads\sample-code-master\sample-code\apps\ApiDemos\bin\ApiDemos-debug.apk' is signed with the default certificate
[ADB] Getting install status for io.appium.android.apis
[ADB] Running 'C:\Android\Sdk\platform-tools\adb.exe -P 5037 -s LGHxxxxxx shell dumpsys package io.appium.android.apis'
[ADB] 'io.appium.android.apis' is installed
[ADB] Getting package info for 'io.appium.android.apis'
[ADB] Running 'C:\Android\Sdk\platform-tools\adb.exe -P 5037 -s LGHxxxxxx shell dumpsys package io.appium.android.apis'
[ADB] Cannot read version codes of 'C:\Users\myusername\Downloads\sample-code-master\sample-code\apps\ApiDemos\bin\ApiDemos-debug.apk' and/or 'io.appium.android.apis'
[ADB] Cannot read version names of 'C:\Users\myusername\Downloads\sample-code-master\sample-code\apps\ApiDemos\bin\ApiDemos-debug.apk' and/or 'io.appium.android.apis'
[ADB] The current install state of 'C:\Users\myusername\Downloads\sample-code-master\sample-code\apps\ApiDemos\bin\ApiDemos-debug.apk' is unknown. Installing anyway
[ADB] Running 'C:\Android\Sdk\platform-tools\adb.exe -P 5037 -s LGHxxxxxx features'
[ADB] Running 'C:\Android\Sdk\platform-tools\adb.exe -P 5037 -s LGHxxxxxx shell 'ls -t -1 /data/local/tmp/appium_cache 2>&1 || echo _ERROR_''
[ADB] The current Android API does not support extended ls options. Defaulting to no-options call
[ADB] Running 'C:\Android\Sdk\platform-tools\adb.exe -P 5037 -s LGHxxxxxx shell 'ls /data/local/tmp/appium_cache 2>&1 || echo _ERROR_''
[ADB] The count of applications in the cache: 4
[ADB] The application at 'C:\Users\myusername\Downloads\sample-code-master\sample-code\apps\ApiDemos\bin\ApiDemos-debug.apk' is already cached to '/data/local/tmp/appium_cache/a7c3d3f518bf906dfd994f6290dfc7e6c703ccae.apk'
[ADB] Running 'C:\Android\Sdk\platform-tools\adb.exe -P 5037 -s LGHxxxxxx shell touch -am /data/local/tmp/appium_cache/a7c3d3f518bf906dfd994f6290dfc7e6c703ccae.apk'
[ADB] Running 'C:\Android\Sdk\platform-tools\adb.exe -P 5037 -s LGHxxxxxx shell pm install -r /data/local/tmp/appium_cache/a7c3d3f518bf906dfd994f6290dfc7e6c703ccae.apk'
[ADB] The installation of 'ApiDemos-debug.apk' took 3837ms
[ADB] Install command stdout: pkg: /data/local/tmp/appium_cache/a7c3d3f518bf906dfd994f6290dfc7e6c703ccae.apk
[ADB] Success
[AndroidDriver] Performing fast reset on 'io.appium.android.apis'
[ADB] Getting install status for io.appium.android.apis
[ADB] Running 'C:\Android\Sdk\platform-tools\adb.exe -P 5037 -s LGHxxxxxx shell dumpsys package io.appium.android.apis'
[ADB] 'io.appium.android.apis' is installed
[ADB] Running 'C:\Android\Sdk\platform-tools\adb.exe -P 5037 -s LGHxxxxxx shell am force-stop io.appium.android.apis'
[ADB] Running 'C:\Android\Sdk\platform-tools\adb.exe -P 5037 -s LGHxxxxxx shell pm clear io.appium.android.apis'
[AndroidDriver] Performed fast reset on the installed 'io.appium.android.apis' application (stop and clear)
[UiAutomator2] Performing shallow cleanup of automation leftovers
[UiAutomator2] No obsolete sessions have been detected (Error: Invalid protocol: webproxy.mycompany.net:)
[ADB] Running 'C:\Android\Sdk\platform-tools\adb.exe -P 5037 -s LGHxxxxxx shell am force-stop io.appium.uiautomator2.server.test'
[UiAutomator2] Starting UIAutomator2 server 4.5.5
[UiAutomator2] Using UIAutomator2 server from 'C:\Program Files\Appium\resources\app\node_modules\appium\node_modules\appium-uiautomator2-server\apks\appium-uiautomator2-server-v4.5.5.apk' and test from 'C:\Program Files\Appium\resources\app\node_modules\appium\node_modules\appium-uiautomator2-server\apks\appium-uiautomator2-server-debug-androidTest.apk'
[UiAutomator2] Waiting up to 30000ms for UiAutomator2 to be online...
[ADB] Creating ADB subprocess with args: ["-P",5037,"-s","LGHxxxxxx","shell","am","instrument","-w","io.appium.uiautomator2.server.test/androidx.test.runner.AndroidJUnitRunner"]
[Instrumentation] INSTRUMENTATION_RESULT: shortMsg=Process crashed.
[Instrumentation] INSTRUMENTATION_CODE: 0
[WD Proxy] Matched '/status' to command name 'getStatus'
[WD Proxy] Proxying [GET /status] to [GET http://127.0.0.1:8200/wd/hub/status] with no body
[WD Proxy] Got response with unknown status: {}
[Instrumentation] The process has exited with code 0
[Instrumentation] io.appium.uiautomator2.server.test.AppiumUiAutomator2Server:
[WD Proxy] Matched '/status' to command name 'getStatus'
[WD Proxy] Proxying [GET /status] to [GET http://127.0.0.1:8200/wd/hub/status] with no body
[WD Proxy] Got response with unknown status: {}
[WD Proxy] Matched '/status' to command name 'getStatus'
...

[WD Proxy] Got response with unknown status: {}
[UiAutomator2] The instrumentation process cannot be initialized within 30000ms timeout. Make sure the application under test does not crash and investigate the logcat output. You could also try to increase the value of 'uiautomator2ServerLaunchTimeout' capability. 
[UiAutomator2] Deleting UiAutomator2 session
[UiAutomator2] Deleting UiAutomator2 server session
[WD Proxy] Matched '/' to command name 'deleteSession'
[UiAutomator2] Did not get confirmation UiAutomator2 deleteSession worked; Error was: UnknownError: An unknown server-side error occurred while processing the command. Original error: Trying to proxy a session command without session id
[ADB] Running 'C:\Android\Sdk\platform-tools\adb.exe -P 5037 -s LGHxxxxxx shell am force-stop io.appium.android.apis'
[Logcat] Stopping logcat capture
[ADB] Removing forwarded port socket connection: 8200 
[ADB] Running 'C:\Android\Sdk\platform-tools\adb.exe -P 5037 -s LGHxxxxxx forward --remove tcp\:8200'
[BaseDriver] Event 'newSessionStarted' logged at 1592982423711 (09:07:03 GMT+0200 (Central European Summer Time))
[W3C] Encountered internal error running command: Error: The instrumentation process cannot be initialized within 30000ms timeout. Make sure the application under test does not crash and investigate the logcat output. You could also try to increase the value of 'uiautomator2ServerLaunchTimeout' capability. 
[W3C]     at Object.errorAndThrow (C:\Program Files\Appium\resources\app\node_modules\appium\node_modules\appium-support\lib\logging.js:87:35)
[W3C]     at UiAutomator2Server.startSession (C:\Program Files\Appium\resources\app\node_modules\appium\node_modules\appium-uiautomator2-driver\lib\uiautomator2.js:220:15)
[W3C] Destroying socket connection
[HTTP] <-- POST /wd/hub/session 500 57707 ms - 1067

Python log

Traceback (most recent call last):
  File "C:/Users/myusername/PycharmProjects/tAppium/sample.py", line 17, in <module>
    android_driver = webdriver.Remote(appium_url, android_caps)
  File "C:\Users\myusername\PycharmProjects\tAppium\venv\lib\site-packages\appium\webdriver\webdriver.py", line 151, in __init__
    super().__init__(
  File "C:\Users\myusername\PycharmProjects\tAppium\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 157, in __init__
    self.start_session(capabilities, browser_profile)
  File "C:\Users\myusername\PycharmProjects\tAppium\venv\lib\site-packages\appium\webdriver\webdriver.py", line 225, in start_session
    response = self.execute(RemoteCommand.NEW_SESSION, parameters)
  File "C:\Users\myusername\PycharmProjects\tAppium\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "C:\Users\myusername\PycharmProjects\tAppium\venv\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: The instrumentation process cannot be initialized within 30000ms timeout. Make sure the application under test does not crash and investigate the logcat output. You could also try to increase the value of 'uiautomator2ServerLaunchTimeout' capability.