Connection Errors
There are various connection errors you may run into. Examine the log to see which one applies to you.
Initial Checks
Please ensure you are using Bluestacks 5 not Bluestacks X
Error Message
appium-uiautomator2-server-v4.27.0.apk' timed out after 20000ms'. Try to increase the 20000ms adb execution timeout represented by 'uiautomator2ServerInstallTimeout' capability
Solution
This message indicates that the Bluestacks instance you are attempting to connect to is not responding. This issue usually arises after creating a new instance in Bluestacks. Something just did not work correctly and it cannot accept connections.
Step 1 would be to delete the current Bluestacks instance and create another new one with the hope that this one would not have the same issue.
If you find that this does not help, Step 2 would be to uninstall and reinstall Bluestacks 5.
Error Message
settings delete global hidden_api_policy_pre_p_apps;
settings delete global hidden_api_policy_p_apps;
settings delete global hidden_api_policy''
exited with code 1'; Command output: error: closed
Solution
This message indicates that the Bluestacks instance you connected to is prematurely closing the connection. It can also mean that permissions on the instance are too restrictive and the ADB connection is not allowed to make the necessary changes.
Step 1 would be to delete the current Bluestacks instance and create another new one with the hope that this one would not have the same issue.
If you find that this does not help, Step 2 would be to uninstall and reinstall Bluestacks 5.