8

I am trying to setup automated tests for an android app using Appium (npm version) but I keep getting the error

[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 [UiAutomator2] Unable to remove port forward 'Error executing adbExec. Original error: 'Command '/usr/local/android-sdk/platform-tools/adb -P 5037 -s emulator-5554 forward --remove tcp\:8200' exited with code 1'; Stderr: 'error: listener 'tcp:8200' not found'; Code: '1''

I have looked around google for ages but havnt been able to find any solution that has actually worked for me, so far totalling 50 failed builds.

If i run the commands on my local machine it works fine but within travis I have no such luck unfortunately. I am new to setting up appium so it could be something minor im not understanding.

A gist of my travis.yml file is here

Distribution: Distributor ID: Ubuntu Description: Ubuntu 14.04.5 LTS Release: 14.04 Codename: trusty

Thanks in advance.

Wasiq Bhamla
  • 949
  • 1
  • 7
  • 12
danwoodbury
  • 311
  • 1
  • 11

2 Answers2

0

tcp:8200 is not forwarded and there should be no forwards.

try with adb forward --remove-all, when not knowing which port it is

... if it's even required to remove any forward.

Martin Zeitler
  • 1
  • 19
  • 155
  • 216
0

After looking at the logs, I understand that the emulator is not ready to allow UiAutomator to get deployed properly.

So to make sure that emulator is ready, you can use avdLaunchTimeout and avdReadyTimeout by passing 60000 ms to both in your desired capabilities.

Once the emulator is ready, you won't get this error.

Wasiq Bhamla
  • 949
  • 1
  • 7
  • 12
  • thanks but unfortunately this didnt work. The default for those capabilities is 60000 anyway so I put in a huge number too but its the same issue. This is baffling me – danwoodbury Jan 03 '19 at 15:30
  • Can you try removing the lines from your travis yml file where you start the emulator and wait for it to load? Also add `avd` capability to your desired capabilities with Emulator name. This will instruct Appium to start the emulator for you and avdReadyTimeout and avdLaunchTimeout will come into work. – Wasiq Bhamla Jan 03 '19 at 15:38
  • If you still can't figure out, check out my framework's azure pipeline yaml file. https://github.com/WasiqB/coteafs-appium/blob/master/azure-pipelines.yml – Wasiq Bhamla Jan 03 '19 at 15:41
  • great thanks, there a few things I cantry there. Is there a chance you could share with me the capabilities you are setting so I can match them up? Im very new to appium and the girl who wrote the tests dosnt know anything about CI so im helping out, or trying to anyway – danwoodbury Jan 03 '19 at 16:18
  • If you want, you can try my framework (link already shared above). The capabilities are stored in yml file and dynamically used by the framework. – Wasiq Bhamla Jan 03 '19 at 16:24