[Appium 1] Error about: A session is either terminated or not started

When I try to run test on a device, appium server keep creating new session.
Here is the log.
This device can run tests on another application.But when running the package that needs to be tested, an error occurs.
Try to reboot the Android device and Window PC, still not work.

[Device Environment]
platformName = Android
platformVersion = 12
deviceName = Android Device
appPackage = com.package
appActivity = com.package.StartupActivity
automationName = uiautomator2
unicodeKeyboard = true
resetKeyboard = true
noReset = true
skipServerInstallation = true
skipDeviceInitialization = true
url = http://localhost:4723/wd/hub
Appium logs

[debug] [HTTP] Request idempotency key: 4f9a214b-4b63-4629-bc77-3e0994ad3ecc
[HTTP] --> POST /wd/hub/session
[HTTP] {"capabilities":{"firstMatch":[{}],"alwaysMatch":{"platformName":"Android","appium:platformVersion":"12","appium:deviceName":"Android Device","appium:appPackage":"com.package","appium:appActivity":"com.package.StartupActivity","appium:automationName":"uiautomator2","appium:resetKeyboard":"true","appium:unicodeKeyboard":"true","appium:skipServerInstallation":"true","appium:skipDeviceInitialization":"true","appium:noReset":"true"}}}
[debug] [W3C] Calling AppiumDriver.createSession() with args: [null,null,{"firstMatch":[{}],"alwaysMatch":{"platformName":"Android","appium:platformVersion":"12","appium:deviceName":"Android Device","appium:appPackage":"com.package","appium:appActivity":"com.package.StartupActivity","appium:automationName":"uiautomator2","appium:resetKeyboard":"true","appium:unicodeKeyboard":"true","appium:skipServerInstallation":"true","appium:skipDeviceInitialization":"true","appium:noReset":"true"}}]
[debug] [BaseDriver] Event 'newSessionRequested' logged at 1719053267443 (18:47:47 GMT+0800 (中国标准时间))
[Appium] Appium v1.22.1 creating new AndroidUiautomator2Driver (v1.70.1) session
[debug] [Appium] Cleaning up 1 active session
[Appium] Removing session 6424bff5-2a9f-4c97-97b8-dc2101c8802e from our master session list
[debug] [UiAutomator2] Deleting UiAutomator2 session
[debug] [UiAutomator2] Deleting UiAutomator2 server session
[debug] [WD Proxy] Matched '/' to command name 'deleteSession'
[debug] [WD Proxy] Proxying [DELETE /] to [DELETE http://127.0.0.1:8202/wd/hub/session/4a95429c-f17b-402b-b163-77052e1fc379] with no body
[debug] [WD Proxy] Got response with status 200: {"sessionId":"4a95429c-f17b-402b-b163-77052e1fc379","value":null}
[debug] [UiAutomator2] Resetting IME to 'com.package.kime/.TrimeImeService'
[debug] [ADB] Running 'F:\Android SDK\platform-tools\adb.exe -P 5037 -s A1F985EB shell ime set com.package.kime/.TrimeImeService'
[debug] [ADB] Running 'F:\Android SDK\platform-tools\adb.exe -P 5037 -s A1F985EB shell am force-stop com.package'
[debug] [Logcat] Stopping logcat capture
[debug] [ADB] Removing forwarded port socket connection: 8202
[debug] [ADB] Running 'F:\Android SDK\platform-tools\adb.exe -P 5037 -s A1F985EB forward --remove tcp:8202'
[debug] [Instrumentation] .
[debug] [Instrumentation] Time: 5.057
[debug] [Instrumentation]
[debug] [Instrumentation] OK (1 test)
[UiAutomator2] Restoring hidden api policy to the device default configuration
[debug] [ADB] Running 'F:\Android SDK\platform-tools\adb.exe -P 5037 -s A1F985EB shell 'settings delete global hidden_api_policy_pre_p_apps;settings delete global hidden_api_policy_p_apps;settings delete global hidden_api_policy''
[debug] [BaseDriver] Creating session with W3C capabilities: {
[debug] [BaseDriver]   "alwaysMatch": {
[debug] [BaseDriver]     "platformName": "Android",
[debug] [BaseDriver]     "appium:platformVersion": "12",
[debug] [BaseDriver]     "appium:deviceName": "Android Device",
[debug] [BaseDriver]     "appium:appPackage": "com.package",
[debug] [BaseDriver]     "appium:appActivity": "com.package.StartupActivity",
[debug] [BaseDriver]     "appium:automationName": "uiautomator2",
[debug] [BaseDriver]     "appium:resetKeyboard": "true",
[debug] [BaseDriver]     "appium:unicodeKeyboard": "true",
[debug] [BaseDriver]     "appium:skipServerInstallation": "true",
[debug] [BaseDriver]     "appium:skipDeviceInitialization": "true",
[debug] [BaseDriver]     "appium:noReset": "true"
[debug] [BaseDriver]   },
[debug] [BaseDriver]   "firstMatch": [
[debug] [BaseDriver]     {}
[debug] [BaseDriver]   ]
[debug] [BaseDriver] }
[BaseDriver] Capability 'noReset' changed from string to boolean. This may cause unexpected behavior
[BaseDriver] Capability 'skipServerInstallation' changed from string to boolean. This may cause unexpected behavior
[BaseDriver] Capability 'unicodeKeyboard' changed from string to boolean. This may cause unexpected behavior
[BaseDriver] Capability 'resetKeyboard' changed from string to boolean. This may cause unexpected behavior
[BaseDriver] Capability 'skipDeviceInitialization' changed from string to boolean. This may cause unexpected behavior
[BaseDriver] Session created with session id: 244ea89d-36a7-43da-a0d6-9c15865d8aba
[UiAutomator2] Starting 'com.package' directly on the device
[ADB] Using 'adb.exe' from 'F:\Android SDK\platform-tools\adb.exe'
[debug] [ADB] Running 'F:\Android SDK\platform-tools\adb.exe -P 5037 start-server'
[AndroidDriver] Retrieving device list
[debug] [ADB] Trying to find a connected android device
[debug] [ADB] Getting connected devices
[debug] [ADB] Connected devices: [{"udid":"A1F985EB","state":"device"}]
[AndroidDriver] Looking for a device with Android '12.0.0'
[debug] [ADB] Setting device id to A1F985EB
[ADB] Getting device platform version
[debug] [ADB] Running 'F:\Android SDK\platform-tools\adb.exe -P 5037 -s A1F985EB shell getprop ro.build.version.release'[debug] [ADB] Current device property 'ro.build.version.release': 12
[AndroidDriver] Using device: A1F985EB
[ADB] Using 'adb.exe' from 'F:\Android SDK\platform-tools\adb.exe'
[debug] [ADB] Running 'F:\Android SDK\platform-tools\adb.exe -P 5037 start-server'
[debug] [ADB] Setting device id to A1F985EB
[debug] [ADB] Running 'F:\Android SDK\platform-tools\adb.exe -P 5037 -s A1F985EB shell getprop ro.build.version.sdk'
[debug] [ADB] Current device property 'ro.build.version.sdk': 32
[ADB] Getting device platform version
[debug] [ADB] Running 'F:\Android SDK\platform-tools\adb.exe -P 5037 -s A1F985EB shell getprop ro.build.version.release'[debug] [ADB] Current device property 'ro.build.version.release': 12
[debug] [ADB] Device API level: 32
[UiAutomator2] Relaxing hidden api policy
[debug] [ADB] Running 'F:\Android SDK\platform-tools\adb.exe -P 5037 -s A1F985EB shell 'settings put global hidden_api_policy_pre_p_apps 1;settings put global hidden_api_policy_p_apps 1;settings put global hidden_api_policy 1''
[AndroidDriver] No app sent in, not parsing package/activity
[AndroidDriver] 'skipDeviceInitialization' is set. Skipping device initialization.
[debug] [ADB] Running 'F:\Android SDK\platform-tools\adb.exe -P 5037 -s A1F985EB shell appops set io.appium.settings android:mock_location allow'
[debug] [Instrumentation] The process has exited with code 0
[debug] [Logcat] Starting logs capture with command: 'F:\\Android SDK\\platform-tools\\adb.exe' -P 5037 -s A1F985EB logcat -v threadtime
[debug] [AndroidDriver] Enabling Unicode keyboard support
[debug] [ADB] Running 'F:\Android SDK\platform-tools\adb.exe -P 5037 -s A1F985EB shell settings get secure default_input_method'
[debug] [AndroidDriver] Unsetting previous IME com.package.kime/.TrimeImeService
[debug] [AndroidDriver] Setting IME to 'io.appium.settings/.UnicodeIME'
[debug] [ADB] Running 'F:\Android SDK\platform-tools\adb.exe -P 5037 -s A1F985EB shell ime enable io.appium.settings/.UnicodeIME'
[debug] [ADB] Running 'F:\Android SDK\platform-tools\adb.exe -P 5037 -s A1F985EB shell ime set io.appium.settings/.UnicodeIME'
[debug] [UiAutomator2] Forwarding UiAutomator2 Server port 6790 to local port 8202
[debug] [ADB] Forwarding system: 8202 to device: 6790
[debug] [ADB] Running 'F:\Android SDK\platform-tools\adb.exe -P 5037 -s A1F985EB forward tcp:8202 tcp:6790'
[UiAutomator2] 'skipServerInstallation' is set. Skipping UIAutomator2 server installation.
[debug] [UiAutomator2] No app capability. Assuming it is already on the device
[debug] [UiAutomator2] Performing shallow cleanup of automation leftovers
[debug] [UiAutomator2] No obsolete sessions have been detected (socket hang up)
[debug] [ADB] Running 'F:\Android SDK\platform-tools\adb.exe -P 5037 -s A1F985EB shell am force-stop io.appium.uiautomator2.server.test'
[UiAutomator2] 'skipServerInstallation' is set. Attempting to use UIAutomator2 server from the device
[UiAutomator2] Waiting up to 30000ms for UiAutomator2 to be online...
[debug] [ADB] Creating ADB subprocess with args: ["-P",5037,"-s","A1F985EB","shell","am","instrument","-w","-e","disableAnalytics",true,"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://127.0.0.1:8202/wd/hub/status] with no body
[WD Proxy] socket hang up
[debug] [Instrumentation] io.appium.uiautomator2.server.test.AppiumUiAutomator2Server:
[debug] [WD Proxy] Matched '/status' to command name 'getStatus'
[debug] [WD Proxy] Proxying [GET /status] to [GET http://127.0.0.1:8202/wd/hub/status] with no body
[WD Proxy] socket hang up
[debug] [WD Proxy] Matched '/status' to command name 'getStatus'
[debug] [WD Proxy] Proxying [GET /status] to [GET http://127.0.0.1:8202/wd/hub/status] with no body
[debug] [WD Proxy] Got response with status 200: {"sessionId":"None","value":{"message":"UiAutomator2 Server is ready to accept commands","ready":true}}
[debug] [UiAutomator2] The initialization of the instrumentation process took 2126ms
[debug] [WD Proxy] Matched '/session' to command name 'createSession'
[debug] [WD Proxy] Proxying [POST /session] to [POST http://127.0.0.1:8202/wd/hub/session] with body: {"capabilities":{"firstMatch":[{"platform":"LINUX","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"platformName":"Android","platformVersion":"12","deviceName":"Android Device","appPackage":"com.package","appActivity":"com.package.StartupActivity","automationName":"uiautomator2","resetKeyboard":true,"unicodeKeyboard":true,"skipServerInstallation":true,"skipDeviceInitialization":true,"noReset":true},"platformName":"Android","platformVersion":"12","deviceName":"A1F985EB","appPackage":"com.package","appActivity":"com.package.StartupActivity","automationName":"uiautomator2","resetKeyboard":true,"unicodeKeyboard":true,"skipServerInstallation":true,"skipDeviceInitialization":true,"noReset":true,"deviceUDID":"A1F985EB"}],"alwaysMatch":{}}}
[debug] [WD Proxy] Got response with status 200: {"sessionId":"43dbb71d-b917-4c32-9be8-aac529c0d59f","value":{"capabilities":{"firstMatch":[{"platform":"LINUX","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"platformName":"Android","platformVersion":"12","deviceName":"Android Device","appPackage":"com.package","appActivity":"com.package.StartupActivity","automationName":"uiautomator2","resetKeyboard":true,"unicodeKeyboard":true,"skipServerInstallation":true,"skipDeviceInitialization":true,"noReset":true},"platformName":"Android","platformVersion":"12","deviceName":"A1F985EB","appPackage":"com.package","appActivity":"com.package.StartupActivity","automationName":"uiautomator2","resetKeyboard":true,"unicodeKeyboard":true,"skipServerInstallation":true,"skipDeviceInitialization":true,"noReset":true,"deviceUDID":"A1F985EB"}],"alwaysMatch":{}},"sessionId":"43dbb71d-b917-4c32-9be8-aac529c0d59f"}}
[WD Proxy] Determined the downstream protocol as 'W3C'
[debug] [WD Proxy] Proxying [GET /appium/device/info] to [GET http://127.0.0.1:8202/wd/hub/session/43dbb71d-b917-4c32-9be8-aac529c0d59f/appium/device/info] with no body
[debug] [WD Proxy] Got response with status 200: {"sessionId":"43dbb71d-b917-4c32-9be8-aac529c0d59f","value":{"androidId":"79b6f0f6c765c336","apiVersion":"32","bluetooth":{"state":"ON"},"brand":"Test","carrierName":"","displayDensity":350,"locale":"en_US","manufacturer":"QUALCOMM","model":"Android Device","networks":[{"capabilities":{"SSID":null,"linkDownBandwidthKbps":35636,"linkUpstreamBandwidthKbps":18431,"networkCapabilities":"NET_CAPABILITY_NOT_METERED,NET_CAPABILITY_INTERNET,NET_CAPABILITY_NOT_RESTRICTED,NET_CAPABILITY_TRUSTED,NET_CAPABILITY_NOT_VPN,NET_CAPABILITY_VALIDATED,NET_CAPABILITY_NOT_ROAMING,NET_CAPABILITY_FOREGROUND,NET_CAPABILITY_NOT_CONGESTED,NET_CAPABILITY_NOT_SUSPENDED","signalStrength":-52,"transportTypes":"TRANSPORT_WIFI"},"detailedState":"CONNECTED","extraInfo":"","isAvailable":true,"isConnected":true,"isFailover":false,"isRoaming":false,"state":"CONNECTED","subtype":-1,"subtypeName":"","type":1,"typeName":"WIFI"}],"platformVersion":"12","realDisplaySize":"1404x1872","timeZone":"Asia/Shanghai"}}
[debug] [ADB] Running 'F:\Android SDK\platform-tools\adb.exe -P 5037 -s A1F985EB shell dumpsys window'
[AndroidDriver] Screen already unlocked, doing nothing
[UiAutomator2] Starting 'com.package/com.package.StartupActivity and waiting for 'com.package/com.package.StartupActivity'
[debug] [ADB] Running 'F:\Android SDK\platform-tools\adb.exe -P 5037 -s A1F985EB shell am start -W -n com.package/com.package.StartupActivity -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000'
[debug] [WD Proxy] Proxying [GET /appium/device/pixel_ratio] to [GET http://127.0.0.1:8202/wd/hub/session/43dbb71d-b917-4c32-9be8-aac529c0d59f/appium/device/pixel_ratio] with no body
[debug] [WD Proxy] Got response with status 200: {"sessionId":"43dbb71d-b917-4c32-9be8-aac529c0d59f","value":2.1875}
[debug] [WD Proxy] Matched '/appium/device/system_bars' to command name 'getSystemBars'
[debug] [WD Proxy] Proxying [GET /appium/device/system_bars] to [GET http://127.0.0.1:8202/wd/hub/session/43dbb71d-b917-4c32-9be8-aac529c0d59f/appium/device/system_bars] with no body
[debug] [WD Proxy] Got response with status 200: {"sessionId":"43dbb71d-b917-4c32-9be8-aac529c0d59f","value":{"statusBar":101}}
[debug] [WD Proxy] Matched '/window/current/size' to command name 'getWindowSize'
[debug] [WD Proxy] Proxying [GET /window/current/size] to [GET http://127.0.0.1:8202/wd/hub/session/43dbb71d-b917-4c32-9be8-aac529c0d59f/window/current/size] with no body
[debug] [WD Proxy] Got response with status 200: {"sessionId":"43dbb71d-b917-4c32-9be8-aac529c0d59f","value":{"height":1872,"width":1404}}
[Appium] New AndroidUiautomator2Driver session created successfully, session 244ea89d-36a7-43da-a0d6-9c15865d8aba added to master session list
[debug] [BaseDriver] Event 'newSessionStarted' logged at 1719053271797 (18:47:51 GMT+0800 (中国标准时间))
[debug] [W3C (244ea89d)] Cached the protocol value 'W3C' for the new session 244ea89d-36a7-43da-a0d6-9c15865d8aba
[debug] [W3C (244ea89d)] Responding to client with driver.createSession() result: {"capabilities":{"platform":"LINUX","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"platformName":"Android","platformVersion":"12","deviceName":"Android Device","appPackage":"com.package","appActivity":"com.package.StartupActivity","automationName":"uiautomator2","resetKeyboard":true,"unicodeKeyboard":true,"skipServerInstallation":true,"skipDeviceInitialization":true,"noReset":true},"platformName":"Android","platformVersion":"12","deviceName":"A1F985EB","appPackage":"com.package","appActivity":"com.package.StartupActivity","automationName":"uiautomator2","resetKeyboard":true,"unicodeKeyboard":true,"skipServerInstallation":true,"skipDeviceInitialization":true,"noReset":true,"deviceUDID":"A1F985EB","deviceApiLevel":32,"deviceScreenSize":"1404x1872","deviceScreenDensity":350,"deviceModel":"Android Device","deviceManufacturer":"QUALCOMM","pixelRatio":2.1875,"statBarHeight":101,"viewportRect":{"left":0...
[HTTP] <-- POST /wd/hub/session 200 4357 ms - 1122
[HTTP]
[debug] [HTTP] Request idempotency key: e1e667e9-66f5-4bda-b0d3-c2ccbb5f6fcf
[HTTP] --> POST /wd/hub/session
[HTTP] {"capabilities":{"firstMatch":[{}],"alwaysMatch":{"platformName":"Android","appium:platformVersion":"12","appium:deviceName":"Android Device","appium:appPackage":"com.package","appium:appActivity":"com.package.StartupActivity","appium:automationName":"uiautomator2","appium:resetKeyboard":"true","appium:unicodeKeyboard":"true","appium:skipServerInstallation":"true","appium:skipDeviceInitialization":"true","appium:noReset":"true"}}}
[debug] [W3C] Calling AppiumDriver.createSession() with args: [null,null,{"firstMatch":[{}],"alwaysMatch":{"platformName":"Android","appium:platformVersion":"12","appium:deviceName":"Android Device","appium:appPackage":"com.package","appium:appActivity":"com.package.StartupActivity","appium:automationName":"uiautomator2","appium:resetKeyboard":"true","appium:unicodeKeyboard":"true","appium:skipServerInstallation":"true","appium:skipDeviceInitialization":"true","appium:noReset":"true"}}]
[debug] [BaseDriver] Event 'newSessionRequested' logged at 1719053273828 (18:47:53 GMT+0800 (中国标准时间))
[Appium] Appium v1.22.1 creating new AndroidUiautomator2Driver (v1.70.1) session
[debug] [Appium] Cleaning up 1 active session
[Appium] Removing session 244ea89d-36a7-43da-a0d6-9c15865d8aba from our master session list
[debug] [UiAutomator2] Deleting UiAutomator2 session
[debug] [UiAutomator2] Deleting UiAutomator2 server session
[debug] [WD Proxy] Matched '/' to command name 'deleteSession'
[debug] [WD Proxy] Proxying [DELETE /] to [DELETE http://127.0.0.1:8202/wd/hub/session/43dbb71d-b917-4c32-9be8-aac529c0d59f] with no body
[debug] [WD Proxy] Got response with status 200: {"sessionId":"43dbb71d-b917-4c32-9be8-aac529c0d59f","value":null}
[debug] [UiAutomator2] Resetting IME to 'com.package.kime/.TrimeImeService'
[debug] [ADB] Running 'F:\Android SDK\platform-tools\adb.exe -P 5037 -s A1F985EB shell ime set com.package.kime/.TrimeImeService'
[debug] [ADB] Running 'F:\Android SDK\platform-tools\adb.exe -P 5037 -s A1F985EB shell am force-stop com.package'
[debug] [Logcat] Stopping logcat capture
[debug] [ADB] Removing forwarded port socket connection: 8202
[debug] [ADB] Running 'F:\Android SDK\platform-tools\adb.exe -P 5037 -s A1F985EB forward --remove tcp:8202'
[UiAutomator2] Restoring hidden api policy to the device default configuration
[debug] [ADB] Running 'F:\Android SDK\platform-tools\adb.exe -P 5037 -s A1F985EB shell 'settings delete global hidden_api_policy_pre_p_apps;settings delete global hidden_api_policy_p_apps;settings delete global hidden_api_policy''
[debug] [Instrumentation] .
[debug] [Instrumentation]
[debug] [Instrumentation] Time: 4.055
[debug] [Instrumentation]
[debug] [Instrumentation] OK (1 test)
[debug] [BaseDriver] Creating session with W3C capabilities: {
[debug] [BaseDriver]   "alwaysMatch": {
[debug] [BaseDriver]     "platformName": "Android",
[debug] [BaseDriver]     "appium:platformVersion": "12",
[debug] [BaseDriver]     "appium:deviceName": "Android Device",
[debug] [BaseDriver]     "appium:appPackage": "com.package",
[debug] [BaseDriver]     "appium:appActivity": "com.package.StartupActivity",
[debug] [BaseDriver]     "appium:automationName": "uiautomator2",
[debug] [BaseDriver]     "appium:resetKeyboard": "true",
[debug] [BaseDriver]     "appium:unicodeKeyboard": "true",
[debug] [BaseDriver]     "appium:skipServerInstallation": "true",
[debug] [BaseDriver]     "appium:skipDeviceInitialization": "true",
[debug] [BaseDriver]     "appium:noReset": "true"
[debug] [BaseDriver]   },
[debug] [BaseDriver]   "firstMatch": [
[debug] [BaseDriver]     {}
[debug] [BaseDriver]   ]
[debug] [BaseDriver] }
[BaseDriver] Capability 'noReset' changed from string to boolean. This may cause unexpected behavior
[BaseDriver] Capability 'skipServerInstallation' changed from string to boolean. This may cause unexpected behavior
[BaseDriver] Capability 'unicodeKeyboard' changed from string to boolean. This may cause unexpected behavior
[BaseDriver] Capability 'resetKeyboard' changed from string to boolean. This may cause unexpected behavior
[BaseDriver] Capability 'skipDeviceInitialization' changed from string to boolean. This may cause unexpected behavior
[BaseDriver] Session created with session id: e2e6dedf-b18d-4e13-a9fe-02b88bd8d3fc
[UiAutomator2] Starting 'com.package' directly on the device
[ADB] Using 'adb.exe' from 'F:\Android SDK\platform-tools\adb.exe'
[debug] [ADB] Running 'F:\Android SDK\platform-tools\adb.exe -P 5037 start-server'
[AndroidDriver] Retrieving device list
[debug] [ADB] Trying to find a connected android device
[debug] [ADB] Getting connected devices
[debug] [ADB] Connected devices: [{"udid":"A1F985EB","state":"device"}]
[AndroidDriver] Looking for a device with Android '12.0.0'
[debug] [ADB] Setting device id to A1F985EB
[ADB] Getting device platform version
[debug] [ADB] Running 'F:\Android SDK\platform-tools\adb.exe -P 5037 -s A1F985EB shell getprop ro.build.version.release'[debug] [ADB] Current device property 'ro.build.version.release': 12
[AndroidDriver] Using device: A1F985EB
[ADB] Using 'adb.exe' from 'F:\Android SDK\platform-tools\adb.exe'
[debug] [ADB] Running 'F:\Android SDK\platform-tools\adb.exe -P 5037 start-server'
[debug] [ADB] Setting device id to A1F985EB
[debug] [ADB] Running 'F:\Android SDK\platform-tools\adb.exe -P 5037 -s A1F985EB shell getprop ro.build.version.sdk'
[debug] [ADB] Current device property 'ro.build.version.sdk': 32
[ADB] Getting device platform version
[debug] [ADB] Running 'F:\Android SDK\platform-tools\adb.exe -P 5037 -s A1F985EB shell getprop ro.build.version.release'[debug] [ADB] Current device property 'ro.build.version.release': 12
[debug] [ADB] Device API level: 32
[UiAutomator2] Relaxing hidden api policy
[debug] [ADB] Running 'F:\Android SDK\platform-tools\adb.exe -P 5037 -s A1F985EB shell 'settings put global hidden_api_policy_pre_p_apps 1;settings put global hidden_api_policy_p_apps 1;settings put global hidden_api_policy 1''
[AndroidDriver] No app sent in, not parsing package/activity
[AndroidDriver] 'skipDeviceInitialization' is set. Skipping device initialization.
[debug] [ADB] Running 'F:\Android SDK\platform-tools\adb.exe -P 5037 -s A1F985EB shell appops set io.appium.settings android:mock_location allow'
[debug] [Logcat] Starting logs capture with command: 'F:\\Android SDK\\platform-tools\\adb.exe' -P 5037 -s A1F985EB logcat -v threadtime
[debug] [Instrumentation] The process has exited with code 0
[debug] [AndroidDriver] Enabling Unicode keyboard support
[debug] [ADB] Running 'F:\Android SDK\platform-tools\adb.exe -P 5037 -s A1F985EB shell settings get secure default_input_method'
[debug] [AndroidDriver] Unsetting previous IME com.package.kime/.TrimeImeService
[debug] [AndroidDriver] Setting IME to 'io.appium.settings/.UnicodeIME'
[debug] [ADB] Running 'F:\Android SDK\platform-tools\adb.exe -P 5037 -s A1F985EB shell ime enable io.appium.settings/.UnicodeIME'
[debug] [ADB] Running 'F:\Android SDK\platform-tools\adb.exe -P 5037 -s A1F985EB shell ime set io.appium.settings/.UnicodeIME'
[debug] [UiAutomator2] Forwarding UiAutomator2 Server port 6790 to local port 8202
[debug] [ADB] Forwarding system: 8202 to device: 6790
[debug] [ADB] Running 'F:\Android SDK\platform-tools\adb.exe -P 5037 -s A1F985EB forward tcp:8202 tcp:6790'
[UiAutomator2] 'skipServerInstallation' is set. Skipping UIAutomator2 server installation.
[debug] [UiAutomator2] No app capability. Assuming it is already on the device
[debug] [UiAutomator2] Performing shallow cleanup of automation leftovers
[debug] [UiAutomator2] No obsolete sessions have been detected (socket hang up)
[debug] [ADB] Running 'F:\Android SDK\platform-tools\adb.exe -P 5037 -s A1F985EB shell am force-stop io.appium.uiautomator2.server.test'
[UiAutomator2] 'skipServerInstallation' is set. Attempting to use UIAutomator2 server from the device
[UiAutomator2] Waiting up to 30000ms for UiAutomator2 to be online...
[debug] [ADB] Creating ADB subprocess with args: ["-P",5037,"-s","A1F985EB","shell","am","instrument","-w","-e","disableAnalytics",true,"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://127.0.0.1:8202/wd/hub/status] with no body
[WD Proxy] socket hang up
[debug] [Instrumentation] io.appium.uiautomator2.server.test.AppiumUiAutomator2Server:
[debug] [WD Proxy] Matched '/status' to command name 'getStatus'
[debug] [WD Proxy] Proxying [GET /status] to [GET http://127.0.0.1:8202/wd/hub/status] with no body
[WD Proxy] socket hang up
[debug] [WD Proxy] Matched '/status' to command name 'getStatus'
[debug] [WD Proxy] Proxying [GET /status] to [GET http://127.0.0.1:8202/wd/hub/status] with no body
[WD Proxy] socket hang up
[debug] [WD Proxy] Matched '/status' to command name 'getStatus'
[debug] [WD Proxy] Proxying [GET /status] to [GET http://127.0.0.1:8202/wd/hub/status] with no body
[debug] [WD Proxy] Got response with status 200: {"sessionId":"None","value":{"message":"UiAutomator2 Server is ready to accept commands","ready":true}}
[debug] [UiAutomator2] The initialization of the instrumentation process took 3115ms
[debug] [WD Proxy] Matched '/session' to command name 'createSession'
[debug] [WD Proxy] Proxying [POST /session] to [POST http://127.0.0.1:8202/wd/hub/session] with body: {"capabilities":{"firstMatch":[{"platform":"LINUX","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"platformName":"Android","platformVersion":"12","deviceName":"Android Device","appPackage":"com.package","appActivity":"com.package.StartupActivity","automationName":"uiautomator2","resetKeyboard":true,"unicodeKeyboard":true,"skipServerInstallation":true,"skipDeviceInitialization":true,"noReset":true},"platformName":"Android","platformVersion":"12","deviceName":"A1F985EB","appPackage":"com.package","appActivity":"com.package.StartupActivity","automationName":"uiautomator2","resetKeyboard":true,"unicodeKeyboard":true,"skipServerInstallation":true,"skipDeviceInitialization":true,"noReset":true,"deviceUDID":"A1F985EB"}],"alwaysMatch":{}}}
[debug] [WD Proxy] Got response with status 200: {"sessionId":"f68788e0-a2bb-423d-bc12-91c515e2a988","value":{"capabilities":{"firstMatch":[{"platform":"LINUX","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"platformName":"Android","platformVersion":"12","deviceName":"Android Device","appPackage":"com.package","appActivity":"com.package.StartupActivity","automationName":"uiautomator2","resetKeyboard":true,"unicodeKeyboard":true,"skipServerInstallation":true,"skipDeviceInitialization":true,"noReset":true},"platformName":"Android","platformVersion":"12","deviceName":"A1F985EB","appPackage":"com.package","appActivity":"com.package.StartupActivity","automationName":"uiautomator2","resetKeyboard":true,"unicodeKeyboard":true,"skipServerInstallation":true,"skipDeviceInitialization":true,"noReset":true,"deviceUDID":"A1F985EB"}],"alwaysMatch":{}},"sessionId":"f68788e0-a2bb-423d-bc12-91c515e2a988"}}
[WD Proxy] Determined the downstream protocol as 'W3C'
[debug] [WD Proxy] Proxying [GET /appium/device/info] to [GET http://127.0.0.1:8202/wd/hub/session/f68788e0-a2bb-423d-bc12-91c515e2a988/appium/device/info] with no body
[debug] [WD Proxy] Got response with status 200: {"sessionId":"f68788e0-a2bb-423d-bc12-91c515e2a988","value":{"androidId":"79b6f0f6c765c336","apiVersion":"32","bluetooth":{"state":"ON"},"brand":"Test","carrierName":"","displayDensity":350,"locale":"en_US","manufacturer":"QUALCOMM","model":"Android Device","networks":[{"capabilities":{"SSID":null,"linkDownBandwidthKbps":35636,"linkUpstreamBandwidthKbps":18431,"networkCapabilities":"NET_CAPABILITY_NOT_METERED,NET_CAPABILITY_INTERNET,NET_CAPABILITY_NOT_RESTRICTED,NET_CAPABILITY_TRUSTED,NET_CAPABILITY_NOT_VPN,NET_CAPABILITY_VALIDATED,NET_CAPABILITY_NOT_ROAMING,NET_CAPABILITY_FOREGROUND,NET_CAPABILITY_NOT_CONGESTED,NET_CAPABILITY_NOT_SUSPENDED","signalStrength":-52,"transportTypes":"TRANSPORT_WIFI"},"detailedState":"CONNECTED","extraInfo":"","isAvailable":true,"isConnected":true,"isFailover":false,"isRoaming":false,"state":"CONNECTED","subtype":-1,"subtypeName":"","type":1,"typeName":"WIFI"}],"platformVersion":"12","realDisplaySize":"1404x1872","timeZone":"Asia/Shanghai"}}
[debug] [ADB] Running 'F:\Android SDK\platform-tools\adb.exe -P 5037 -s A1F985EB shell dumpsys window'
[AndroidDriver] Screen already unlocked, doing nothing
[UiAutomator2] Starting 'com.package/com.package.StartupActivity and waiting for 'com.package/com.package.StartupActivity'
[debug] [ADB] Running 'F:\Android SDK\platform-tools\adb.exe -P 5037 -s A1F985EB shell am start -W -n com.package/com.package.StartupActivity -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000'
[debug] [WD Proxy] Proxying [GET /appium/device/pixel_ratio] to [GET http://127.0.0.1:8202/wd/hub/session/f68788e0-a2bb-423d-bc12-91c515e2a988/appium/device/pixel_ratio] with no body
[debug] [WD Proxy] Got response with status 200: {"sessionId":"f68788e0-a2bb-423d-bc12-91c515e2a988","value":2.1875}
[debug] [WD Proxy] Matched '/appium/device/system_bars' to command name 'getSystemBars'
[debug] [WD Proxy] Proxying [GET /appium/device/system_bars] to [GET http://127.0.0.1:8202/wd/hub/session/f68788e0-a2bb-423d-bc12-91c515e2a988/appium/device/system_bars] with no body
[debug] [WD Proxy] Got response with status 200: {"sessionId":"f68788e0-a2bb-423d-bc12-91c515e2a988","value":{"statusBar":101}}
[debug] [WD Proxy] Matched '/window/current/size' to command name 'getWindowSize'
[debug] [WD Proxy] Proxying [GET /window/current/size] to [GET http://127.0.0.1:8202/wd/hub/session/f68788e0-a2bb-423d-bc12-91c515e2a988/window/current/size] with no body
[debug] [WD Proxy] Got response with status 200: {"sessionId":"f68788e0-a2bb-423d-bc12-91c515e2a988","value":{"height":1872,"width":1404}}
[Appium] New AndroidUiautomator2Driver session created successfully, session e2e6dedf-b18d-4e13-a9fe-02b88bd8d3fc added to master session list
[debug] [BaseDriver] Event 'newSessionStarted' logged at 1719053279136 (18:47:59 GMT+0800 (中国标准时间))
[debug] [W3C (e2e6dedf)] Cached the protocol value 'W3C' for the new session e2e6dedf-b18d-4e13-a9fe-02b88bd8d3fc
[debug] [W3C (e2e6dedf)] Responding to client with driver.createSession() result: {"capabilities":{"platform":"LINUX","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"platformName":"Android","platformVersion":"12","deviceName":"Android Device","appPackage":"com.package","appActivity":"com.package.StartupActivity","automationName":"uiautomator2","resetKeyboard":true,"unicodeKeyboard":true,"skipServerInstallation":true,"skipDeviceInitialization":true,"noReset":true},"platformName":"Android","platformVersion":"12","deviceName":"A1F985EB","appPackage":"com.package","appActivity":"com.package.StartupActivity","automationName":"uiautomator2","resetKeyboard":true,"unicodeKeyboard":true,"skipServerInstallation":true,"skipDeviceInitialization":true,"noReset":true,"deviceUDID":"A1F985EB","deviceApiLevel":32,"deviceScreenSize":"1404x1872","deviceScreenDensity":350,"deviceModel":"Android Device","deviceManufacturer":"QUALCOMM","pixelRatio":2.1875,"statBarHeight":101,"viewportRect":{"left":0...
[HTTP] <-- POST /wd/hub/session 200 5310 ms - 1122
[HTTP]
[HTTP] --> POST /wd/hub/session/b5cd917d-d3f5-4b70-8b0d-bc2f62b8dbbb/appium/device/keyevent
[HTTP] {"keycode":3}
[debug] [W3C (b5cd917d)] Encountered internal error running command: NoSuchDriverError: A session is either terminated or not started
[debug] [W3C (b5cd917d)]     at asyncHandler (C:\Users\keeponzhang\AppData\Roaming\npm\node_modules\appium\node_modules\appium-base-driver\lib\protocol\protocol.js:243:15)
[debug] [W3C (b5cd917d)]     at C:\Users\keeponzhang\AppData\Roaming\npm\node_modules\appium\node_modules\appium-base-driver\lib\protocol\protocol.js:423:15
[debug] [W3C (b5cd917d)]     at Layer.handle [as handle_request] (C:\Users\keeponzhang\AppData\Roaming\npm\node_modules\appium\node_modules\express\lib\router\layer.js:95:5)
[debug] [W3C (b5cd917d)]     at next (C:\Users\keeponzhang\AppData\Roaming\npm\node_modules\appium\node_modules\express\lib\router\route.js:137:13)
[debug] [W3C (b5cd917d)]     at Route.dispatch (C:\Users\keeponzhang\AppData\Roaming\npm\node_modules\appium\node_modules\express\lib\router\route.js:112:3)
[debug] [W3C (b5cd917d)]     at Layer.handle [as handle_request] (C:\Users\keeponzhang\AppData\Roaming\npm\node_modules\appium\node_modules\express\lib\router\layer.js:95:5)
[debug] [W3C (b5cd917d)]     at C:\Users\keeponzhang\AppData\Roaming\npm\node_modules\appium\node_modules\express\lib\router\index.js:281:22
[debug] [W3C (b5cd917d)]     at param (C:\Users\keeponzhang\AppData\Roaming\npm\node_modules\appium\node_modules\express\lib\router\index.js:354:14)
[debug] [W3C (b5cd917d)]     at param (C:\Users\keeponzhang\AppData\Roaming\npm\node_modules\appium\node_modules\express\lib\router\index.js:365:14)
[debug] [W3C (b5cd917d)]     at Function.process_params (C:\Users\keeponzhang\AppData\Roaming\npm\node_modules\appium\node_modules\express\lib\router\index.js:410:3)
[debug] [W3C (b5cd917d)]     at next (C:\Users\keeponzhang\AppData\Roaming\npm\node_modules\appium\node_modules\express\lib\router\index.js:275:10)
[debug] [W3C (b5cd917d)]     at logger (C:\Users\keeponzhang\AppData\Roaming\npm\node_modules\appium\node_modules\morgan\index.js:144:5)
[debug] [W3C (b5cd917d)]     at Layer.handle [as handle_request] (C:\Users\keeponzhang\AppData\Roaming\npm\node_modules\appium\node_modules\express\lib\router\layer.js:95:5)
[debug] [W3C (b5cd917d)]     at trim_prefix (C:\Users\keeponzhang\AppData\Roaming\npm\node_modules\appium\node_modules\express\lib\router\index.js:317:13)
[debug] [W3C (b5cd917d)]     at C:\Users\keeponzhang\AppData\Roaming\npm\node_modules\appium\node_modules\express\lib\router\index.js:284:7
[debug] [W3C (b5cd917d)]     at Function.process_params (C:\Users\keeponzhang\AppData\Roaming\npm\node_modules\appium\node_modules\express\lib\router\index.js:335:12)
[HTTP] <-- POST /wd/hub/session/b5cd917d-d3f5-4b70-8b0d-bc2f62b8dbbb/appium/device/keyevent 404 27 ms - 2492
Traceback (most recent call last):
  File "E:\chandler\progress\BooxReader\testcase\test_001_login.py", line 21, in setUp
    KCBP.backToHomepage()
  File "E:\chandler\progress\BooxReader\PageObject\KcbPage.py", line 58, in backToHomepage
    self.driver.keyevent(3)
  File "C:\Users\keeponzhang\AppData\Local\Programs\Python\Python38\lib\site-packages\appium\webdriver\extensions\keyboard.py", line 78, in keyevent
    self.execute(Command.KEY_EVENT, data)
  File "C:\Users\keeponzhang\AppData\Local\Programs\Python\Python38\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 444, in execute
    self.error_handler.check_response(response)
  File "C:\Users\keeponzhang\AppData\Local\Programs\Python\Python38\lib\site-packages\appium\webdriver\errorhandler.py", line 30, in check_response
    raise wde
  File "C:\Users\keeponzhang\AppData\Local\Programs\Python\Python38\lib\site-packages\appium\webdriver\errorhandler.py", line 26, in check_response
    super().check_response(response)
  File "C:\Users\keeponzhang\AppData\Local\Programs\Python\Python38\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 249, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.InvalidSessionIdException: Message: A session is either terminated or not started
Stacktrace:
NoSuchDriverError: A session is either terminated or not started
    at asyncHandler (C:\Users\keeponzhang\AppData\Roaming\npm\node_modules\appium\node_modules\appium-base-driver\lib\protocol\protocol.js:243:15)
    at C:\Users\keeponzhang\AppData\Roaming\npm\node_modules\appium\node_modules\appium-base-driver\lib\protocol\protocol.js:423:15
    at Layer.handle [as handle_request] (C:\Users\keeponzhang\AppData\Roaming\npm\node_modules\appium\node_modules\express\lib\router\layer.js:95:5)
    at next (C:\Users\keeponzhang\AppData\Roaming\npm\node_modules\appium\node_modules\express\lib\router\route.js:137:13)
    at Route.dispatch (C:\Users\keeponzhang\AppData\Roaming\npm\node_modules\appium\node_modules\express\lib\router\route.js:112:3)
    at Layer.handle [as handle_request] (C:\Users\keeponzhang\AppData\Roaming\npm\node_modules\appium\node_modules\express\lib\router\layer.js:95:5)
    at C:\Users\keeponzhang\AppData\Roaming\npm\node_modules\appium\node_modules\express\lib\router\index.js:281:22
    at param (C:\Users\keeponzhang\AppData\Roaming\npm\node_modules\appium\node_modules\express\lib\router\index.js:354:14)
    at param (C:\Users\keeponzhang\AppData\Roaming\npm\node_modules\appium\node_modules\express\lib\router\index.js:365:14)
    at Function.process_params (C:\Users\keeponzhang\AppData\Roaming\npm\node_modules\appium\node_modules\express\lib\router\index.js:410:3)
    at next (C:\Users\keeponzhang\AppData\Roaming\npm\node_modules\appium\node_modules\express\lib\router\index.js:275:10)
    at logger (C:\Users\keeponzhang\AppData\Roaming\npm\node_modules\appium\node_modules\morgan\index.js:144:5)
    at Layer.handle [as handle_request] (C:\Users\keeponzhang\AppData\Roaming\npm\node_modules\appium\node_modules\express\lib\router\layer.js:95:5)
    at trim_prefix (C:\Users\keeponzhang\AppData\Roaming\npm\node_modules\appium\node_modules\express\lib\router\index.js:317:13)
    at C:\Users\keeponzhang\AppData\Roaming\npm\node_modules\appium\node_modules\express\lib\router\index.js:284:7
    at Function.process_params (C:\Users\keeponzhang\AppData\Roaming\npm\node_modules\appium\node_modules\express\lib\router\index.js:335:12)

This version is several years out of support. You should upgrade to Appium 2, migration notes here: