Getting UiAutomator exited unexpectedly with code 0, signal null error - appium

Getting UiAutomator exited unexpectedly with code 0, signal null error on appium version v1.10.0
My Appium server logs :-

Change Android version (I switch it to Pie)
Restart Appium server
Close and Re-open AVD device

In my case, the app was blocking further process. Due to some installed security features, immediately after app launch, all USB ports connections were refused by the app itself. After, the developers shared another apk with disabled security features, the test run was completed

Seems like version issue... Ensure you have the latest sdk and it is updated for the Android version you are using.
Ensure that device is connected properly. At times the USB connection of not done correctly causes this issue.

Phone reboot worked for me. It's a process stuck on Android, at least that was it for me. You could also try
adb shell ps | grep com.android.commands.monkey | awk '{print $2}' | xargs adb shell kill -9
if you do not wish you reboot your phone.
Appium knows about this issue but closed it. I would recommend to move to Espresso for less headaches. Appium is and always will be a beta-state.

For me it was a cable issue. Try changing cables, too. Changing the automation name to uiAutomator1 or uiAutomator2 didn't make any difference, it was still failing. I even tried downloading Android SDK to match version 8, 9, 10.
My tests were running on 6 different real devices. The same script was running fine on 5 devices but throwing uiAutomator stopped unexpectedly for one device.
When I connected the same device with another cable it worked fine.
So when things go crazy, give a break, rethink, stop pulling hair. solution might be super simple.

Related

Getting frequent Kill:9 Error in Xcode and Terminal

I have recently upgraded the Mac OS to Ventura 13.2.1 and Xcode to 14.2, now once I try to compile any application with Xcode, I am getting Kill:9 related issue for random task/framework in the project. I also get Kill:9 issue sometime on terminal as well.
Listing the errors here:
failed to read asset tags: The command `` terminated with uncaught signal 9. The command had no output.
Driver threw jobFailedWithNonzeroExitCode(9, "") without emitting errors.
Unable to execute command: Killed 9 Clang frontend command failed due to signal.
Please help me to resolve this issue/crash.
Open project in Xcode.
Build the app with Simulator (I tried with iPhone 14 Pro)
Error occurs in the build
Ideally project should have compiled without any error.
It sounds to me that the problem is with the installation of Xcode because when an unprivileged task is attempted, the OS will kill it off (with signal 9).
What I recommend is for you to re-install Xcode.
When you first run the new Xcode, it should prompt you for an administrator password in order to install system related components. Make sure you do this step. Hopefully that should then allow you to compile and run your iOS apps.

Failed to execute adb.exe when trying to run Xamarin.UITest

I'm trying to setup a Xamarin UITest without any luck.
When I try to run 'all tests', I get the following error:
execute: C:\Users\Brandon\AppData\Local\Android\android-sdk\platform-tools\adb.exe devices - exit code: 1
error: could not install *smartsocket* listener: cannot bind to 127.0.0.1:5037: Only one usage of each socket address (protocol/network address/port) is normally permitted. (10048)
List of devices attached
adb server version (39) doesn't match this client (36); killing...
could not read ok from ADB Server
* failed to start daemon *
error: cannot connect to daemon
ADB seems to be started just fine and the weird thing is that it seems to be using an adb version from another user, even though..
1) Tools > Options > Xamarin > Android is set to different path than the above-mentioned, for the Android SDK.
2) There is no system environment path variable that I can find for the above-referenced adb.exe path!
Am I missing something?
In my case it was Android Emulator version mismatch. Somehow Emulator got updated to the newer version:
After uninstalling Emulator, switching Feed to Microsoft instead of google and re-installing Emulator - error was gone and everything worked just fine.

Pseudo Terminal Setup Error when running iOS Simulator

I tried to execute my app in the iOS Simulator. The build succeeded, but I got an alert with an error message before running and the app did not execute:
Pseudo Terminal Setup Error
ErrorCode: 1 Errno: 6
What is this and how can I fix this?
Just restart Xcode and run your app again.
A pseudo terminal is an emulated terminal which is controlled by a master application, in this case, Xcode. For some reason, it encountered an error while trying to run that emulated terminal.
A common problem that can cause this is that you tried to run an instance of an iOS application too quickly after stopping another instance.
How to resolve the error:
Quit the simulator
Restart Xcode - (Make sure that you have saved /committed any changes you have made to your code)
I can't post comment, that is why I wrote here. To those for who this issue repeats even after restarting Xcode, remember to kill process at all, don't just close the project.

Xcode 9.2 Simulator Debugging Broken; Could not attach to process id

Xcode 9.2 debugging on an iOS Simulator has completely broken for me.
I worked on this for hours and tried a ton of suggestions short of completely wiping my hard drive and starting out with a fresh operating system install. I ended up filing a bug with Apple. Posting here in case anyone has encountered this problem and has any suggestions.
Summary:
When try to build and run in debug mode with a debug executable. The simulator only opens the application to a white screen and then Xcode pops up an error:
Could not attach to pid: "<a process id>"
Ensure "<app>" is not already running, and "<user>" has permission to debug it.
Steps to Reproduce:
Make any project and try to run on any simulator.
Expected Results:
Debugger successfully attaches to debugger.
Actual Results:
Debugger is never able to attach to the iOS simulator process/app for debugging.
Debugger CAN attach and build and run successfully on a physical device.
Version/Build:
- Xcode Version 9.2 (9C40b)
- macOS Sierra 10.12.6
- Any iOS project
- Any iOS simulator
Other notes:
- Xcode 9.2 was working fine until this problem randomly started. The error initially said:
Failed to initiate service connection to simulator
DTServiceHubClient failed to bless service hub for
simulator iPhone 8 Plus <simulator identifier>
- After rebooting computer, the error shifted to "Could not attached to pid..."
I tried dozens of suggested solutions short of completely wiping my computer including:
Resetting device contents and settings on simulators
Create a new device (even different device and OS combinations)
Try different Xcode projects, even simple one-off single view applications
Looking at the etc/hosts file and verifying localhost can be pinged
Restarting computer multiple times
Deleting out derived data (multiple times)
Let it build and run without attaching debugger, then try to attach debugger by "attach to process id"
Completely uninstalling Xcode and all simulators, and reinstalling.
Removing any invalid certificates in keychain
It turns out our security software was blocking the debugger. Running sudo sysdiagnose helped me find a log entry showing that it was being blocked. The software is Cb Defense (Carbon Black Defense). Apparently the only workaround is for your security team to whitelist by a hash, and that hash could change in the future.
There is a bug in Xcode 9.0-9.2 that causes this issue to appear after running for a while. If you log out and back in it should resolve it for you.

Xcode 7 UI Testing Failure: App accessibility isn't loaded

While I'm running UITests on Simulator with Xcode 7, it's failed when invoking XCUIApplication().launch() with App accessibility isn't loaded
this is a known bug in Xcode bot, usually happens on large server code bases. It's already been filed by Apple Developers (myself as well), and they're 'fixing' it.
Hope this helps.
If you run tests inside CI system under your control, you could possibly reset simulators before running the UI tests. That way the bug is workarounded.
You could reset simulators from command line with following command:
xcrun simctl list | awk -F "[()]" '{ for (i=2; i<NF; i+=2) print $i }' | grep '^[-A-Z0-9]*$' | xargs -I uuid xcrun simctl erase uuid
As pointed in this SO thread you could also use(however I didn't try it):
xcrun simctl erase all
Restarting the device got rid of this issue for me. (I was using a real device not a simulator)
I got this error following a crash in the test app in CI. In my case, I successfully reproduced the issue locally, then it was easy to see that it crashes (a crash alert appears) and to investigate and fix the error.
In my case the alert was also written to stderr, but on the CI it was not redirected to the logs. If I couldn't repro locally, my next step was to find a way to redirect stderr & stdout to logs.

Resources