Appium Inspector disconnects after a short time when connected to an Android device via wifi

I do not have a problem when connect via usb, but when I connect via wifi, At first, Appium Inspector successfully connects to the device, captures the screen of the device corectly , but after that, when I press refresh or click ui ,it does not react and falls into timeout… Where am I making a mistake.

“app”: “C:\Users\Loord\Downloads\”,
“automationName”: “UiAutomator2”,
“platformName”: “Android”,
“deviceId”: “”

Log.txt (122.9 KB)

Why do you say the app is this when log says:

“appium:undefined”: “C:\Users\Loord\Downloads\”

Which leads to:

[AndroidUiautomator2Driver@b79e (f5930977)] Neither ‘app’ nor ‘appPackage’ was set. Starting UiAutomator2 without the target application

Then instrumentation process (uiautomator2) crashes:

[AndroidUiautomator2Driver@b79e (f5930977)] Encountered internal error running command: UnknownError: An unknown server-side error occurred while processing the command. Original error: ‘GET /’ cannot be proxied to UiAutomator2 server because the instrumentation process is not running (probably crashed). Check the server log and/or the logcat output for more details

No doubt it’s a weird log. You should figure out why the capabilities are not what you think they are and fix that. If uiautomator2 crashes then automation will not work. Full stop. You should check the uiautomator2 server log and/or logcat output to see if there are any more details that would be more informative about the crash.

Thank you.
I tried again and “undefined” changed to “app”. But the problem persists. I think the problem is not related to this. In addition, I was able to use the inspector for a few seconds in one of my attempts, then it broke again. I am also attaching the logcat.
Are uiautomator2’s logs separate from these? If so, how can I access them?
Logv2.txt (46.9 KB)
Logcat.txt (497.8 KB)

You might know better than I do. I’m only seeing the logs you’ve shared & haven’t tried to reproduce.

I am seeing entries in the logcat.txt like this:

2024.01.19 12:57:58.112 1529 2699 Info ActivityManager Force stopping io.appium.uiautomator2.server appid=12261 user=0: start instr
2024.01.19 12:57:58.113 1529 2699 Info ActivityManager Killing 20278:io.appium.uiautomator2.server/u0a2261 (adj 0): stop io.appium.uiautomator2.serverstart instr
2024.01.19 12:57:58.113 1529 2699 Debug ActivityManager cleanUpApplicationRecord app: 20278:io.appium.uiautomator2.server/u0a2261, bad: false, restarting: false, allowRestart: true
2024.01.19 12:57:58.113 1529 1841 Warn HwAudioServiceEx SoundEffectState bundle get reserved is invalid
2024.01.19 12:57:58.113 1529 1625 Info HwPowerManagerService appdie release wakelock, pid = 20278, uid = 12261
2024.01.19 12:57:58.114 1529 1625 Info HwPowerManagerService drop from ForceReleasedWakeLocks wl: mLock:159749582 SCREEN_DIM_WAKE_LOCK ‘UiAutomator2:ScreenKeeper’ (uid=12261 pid=20278)
2024.01.19 12:57:58.114 1529 2699 Warn ActivityManager Crash of app io.appium.uiautomator2.server running instrumentation ComponentInfo{io.appium.uiautomator2.server.test/androidx.test.runner.AndroidJUnitRunner}
2024.01.19 12:57:58.114 1529 2699 Info ActivityManager Force stopping io.appium.uiautomator2.server appid=12261 user=0: finished inst
2024.01.19 12:57:58.115 1529 1632 Warn ActivityManager Error shutting down UiAutomationConnection
2024.01.19 12:57:58.116 1529 2699 Info ActivityManager Start to clean activity stack when force stop the app io.appium.uiautomator2.server , reason:finished inst

So the ActivityManager is “Force stopping” uiautomator2. I don’t know enough about the internals of Huawei devices to understand exactly why. Also, I don’t have the matching Appium server log, so can’t correlate the times.

However, my guess would be that the device can’t handle this type of activity. Can you try another?

Not sure about this. You are referring to this from the log:

I did some quick research but did not find anything satisfactory. If I do find something I’ll post it here.