Physical Android Nexus 9 and Appium - Problems :(

Hello All,

I am running into an issue when I try to run my tests against a physical Nexus 9. First, let me describe my environment:

  1. Windows 8 OS
  2. NodeJS, Selenium Webdriver JS, with Webstorm as the IDE
  3. Nexus 9, attached via USB

The tests run successfully when I run against chrome on my PC, but when I try to run on the Nexus 9 with Appium I get the error below. It appears that Appium is looking for an emulator, and not finding it. Being that I am running on a physical device, I think that the emulator should not be required/searched for. Any help/ideas anyone can provided are greatly appreciated.

Checking if an update is available
Update not available
Launching Appium server with command: C:\Program Files (x86)\Appium\node.exe lib\server\main.js --address 127.0.0.1 --port 5567 --avd c --platform-name Android --platform-version 23 --automation-name Appium --device-name “HT59AJT00220” --language en --log-no-color
info: Welcome to Appium v1.4.16 (REV ae6877eff263066b26328d457bd285c0cc62430d)
info: Appium REST http interface listener started on 127.0.0.1:5567
info: [debug] Non-default server args: {“address”:“127.0.0.1”,“port”:5567,“logNoColors”:true,“avd”:“c”,“deviceName”:“HT59AJT00220”,“platformName”:“Android”,“platformVersion”:“23”,“automationName”:“Appium”,“language”:“en”}
info: Console LogLevel: debug
info: → POST /wd/hub/session {“desiredCapabilities”:{“browserName”:“Browser”,“appiumVersion”:“1.4.16.1”,“platformName”:“Android”,“platformVersion”:“5.1.1”,“deviceName”:“”,“udid”:“”,“avd”:“”,“newCommandTimeout”:0,“autoAcceptAlerts”:true,“version”:“”,“javascriptEnabled”:true,“platform”:“ANY”}}
info: Client User-Agent string: admc/wd/0.3.12
info: [debug] The following desired capabilities were provided, but not recognized by appium. They will be passed on to any other services running on this server. : appiumVersion, version, javascriptEnabled, platform
info: Set mode: Proxying straight through to Chromedriver
info: [debug] Looks like we want chrome on android
info: [debug] Creating new appium session 1b303a18-de96-4f86-b16d-1e73f6c48940
info: [debug] Checking whether adb is present
info: [debug] Using adb from C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe
info: [debug] Using fast reset? true
info: [debug] Preparing device for session
info: [debug] Not checking whether app is present since we are assuming it’s already on the device
info: [debug] Trying to find emulator
info: [debug] Getting connected emulators
info: [debug] Getting connected devices…
info: [debug] executing cmd: “C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe” devices
info: [debug] 0 device(s) connected
info: [debug] 0 emulator(s) connected
info: [debug] Launching Emulator with AVD , launchTimeout 120000ms and readyTimeout 120000ms
info: [debug] Checking whether emulator is present
info: [debug] Using emulator from C:\Program Files (x86)\Android\android-sdk\tools\emulator.exe
info: [debug] Setting Android Device Language to en
info: [debug] Trying to find emulator
info: [debug] Getting connected emulators
info: [debug] Getting connected devices…
info: [debug] executing cmd: “C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe” devices
error: Unable to start Emulator: PANIC: ANDROID_SDK_HOME is defined but could not find .ini file in $ANDROID_SDK_HOME.android\avd
(Note: avd is searched in the order of $ANDROID_AVD_HOME,$ANDROID_SDK_HOME.android\avd and $HOME.android\avd)

info: [debug] 0 device(s) connected
info: [debug] 0 emulator(s) connected
info: [debug] Trying to find emulator
info: [debug] Getting connected emulators
info: [debug] Getting connected devices…
info: [debug] executing cmd: “C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe” devices
info: [debug] 0 device(s) connected
info: [debug] 0 emulator(s) connected
info: [debug] Trying to find emulator
info: [debug] Getting connected emulators
info: [debug] Getting connected devices…
info: [debug] executing cmd: “C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe” devices
info: [debug] 0 device(s) connected
info: [debug] 0 emulator(s) connected
info: [debug] Trying to find emulator
info: [debug] Getting connected emulators
info: [debug] Getting connected devices…
info: [debug] executing cmd: “C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe” devices
info: [debug] 0 device(s) connected
info: [debug] 0 emulator(s) connected
info: [debug] Trying to find emulator
info: [debug] Getting connected emulators
info: [debug] Getting connected devices…
info: [debug] executing cmd: “C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe” devices
info: [debug] 0 device(s) connected
info: [debug] 0 emulator(s) connected
info: [debug] Trying to find emulator
info: [debug] Getting connected emulators
info: [debug] Getting connected devices…
info: [debug] executing cmd: “C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe” devices
info: [debug] 0 device(s) connected
info: [debug] 0 emulator(s) connected
info: [debug] Trying to find emulator
info: [debug] Getting connected emulators
info: [debug] Getting connected devices…
info: [debug] executing cmd: “C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe” devices
info: [debug] 0 device(s) connected
info: [debug] 0 emulator(s) connected
info: [debug] Trying to find emulator
info: [debug] Getting connected emulators
info: [debug] Getting connected devices…
info: [debug] executing cmd: “C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe” devices
info: [debug] 0 device(s) connected
info: [debug] 0 emulator(s) connected
info: → GET /wd/hub/session/screenshot {}
info: [debug] Proxying command to null:null
info: [debug] Making http request with opts: {“url”:“http://null:null/wd/hub/session/screenshot”,“method”:“GET”}
info: [debug] Trying to find emulator
info: [debug] Getting connected emulators
info: [debug] Getting connected devices…
info: [debug] executing cmd: “C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe” devices
info: [debug] 0 device(s) connected
info: [debug] 0 emulator(s) connected
info: [debug] Responding to client with error: {“status”:13,“value”:{“message”:“An unknown server-side error occurred while processing the command.”,“origValue”:“Did not successfully proxy server command”},“sessionId”:“1b303a18-de96-4f86-b16d-1e73f6c48940”}
info: ← GET /wd/hub/session/screenshot 500 2276.171 ms - 210
info: → DELETE /wd/hub/session {}
info: [debug] Proxying command to null:null
info: [debug] Making http request with opts: {“url”:“http://null:null/wd/hub/session”,“method”:“DELETE”}
info: [debug] Trying to find emulator
info: [debug] Getting connected emulators
info: [debug] Getting connected devices…
info: [debug] executing cmd: “C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe” devices
info: [debug] 0 device(s) connected
info: [debug] 0 emulator(s) connected
info: [debug] Responding to client with error: {“status”:13,“value”:{“message”:“An unknown server-side error occurred while processing the command.”,“origValue”:“Did not successfully proxy server command”},“sessionId”:“1b303a18-de96-4f86-b16d-1e73f6c48940”}
info: ← DELETE /wd/hub/session 500 2260.889 ms - 210
info: ← POST /wd/hub/session - - ms - -
info: [debug] Trying to find emulator
info: [debug] Getting connected emulators
info: [debug] Getting connected devices…
info: [debug] executing cmd: “C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe” devices
info: [debug] 0 device(s) connected
info: [debug] 0 emulator(s) connected
info: [debug] Trying to find emulator
info: [debug] Getting connected emulators
info: [debug] Getting connected devices…
info: [debug] executing cmd: “C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe” devices
info: [debug] 0 device(s) connected
info: [debug] 0 emulator(s) connected
undefined

Connect your Nexus 9 with your computer, and then run adb devices on the command line. Does the device show up in the output from that command?

Yes. It consistently shows up in the output from that command.

The error log I provided was a result of a run when the Nexus was accidentally not connected. When it is connected, the error is the same. The only difference is that it shows ‘1 device(s) connected’ instead.

I have a list of questions and suggestions you might want to answer or try:

  1. Can you also check if the device has authorized your machine to have adb access to the device?
  2. Also, see what happens if you drop the “–avd c” argument from the Appium launch options.
  3. Make sure your Android tools are up to date.
  4. Try adding the “–suppress-adb-kill-server” option to Appium’s launch options.

Number 2 was my issue. Looks like having that argument in the launch was the root cause. I’m up and running now. Thanks alot for you help with this.

1 Like