Tuesday, 3 November 2015

[Resolved] Appium could not find devices restarting adb server and ENOENT issue

Setting up and configuration of Appium Automation tool can be a headache sometime, as they have published so many version in short span of time. Recently, I was facing an issue on Windows 7 (x64) operating system, where I was using Appium 0.16 version (tried other versions too including latest 1.2), with Java jdk 1.7.0_67, and Android Debug Bridge 1.0.31
and the error I got was warn code=enoent errno=enoent syscall=spawn info could not find devices restarting adb server
To make suer that I have set up everything correctly, as per appium read me instructions, I ran Appium Doctor command, which was saying that I had configured appium correctly:
C:\Appium\node_modules.bin>appium-doctor -android
Running Android Checks
? ANDROID_HOME is set to “C:\Android_SDK”
? JAVA_HOME is set to “C:\Program Files\Java\jdk1.7.0_67.”
? ADB exists at C:\Android_SDK\platform-tools\adb.exe
? Android exists at C:\Android_SDK\tools\android.bat
? Emulator exists at C:\Android_SDK\tools\emulator.exe
? Android Checks were successful.
? All Checks were successful
Problem: When I open appium.exe, it wasn’t populating AVD devices drop down (Ideally that drop down displays all the AVD devices you have created under your user account on that machine. I had few AVD devices created)
Appium doesnt show AVD devices in Dropdown
But if I go to command prompt and open Appium.exe it was populating the AVD names in drop down, but it was of no use as when I launch the appium by clicking on launch buttion (with pre-launch option and all other capabilities) appium was throwing following error related to could not find devices restarting adb and ENOENT issue:
Starting Node Server
ERROR: debug: Starting Appium in pre-launch mode
info: Pre-launching app
ERROR: debug: Using local app from command line: C:\sdk\build-tools\android-4.4W\app-debug.apk
info: Starting android appium
ERROR: debug: Creating new appium session 2b76fae6-2605-47dd-9a23-c47a402663af
ERROR: debug: Using fast reset? true
info: Retrieving device
ERROR: debug: Preparing device for session
ERROR: debug: Checking whether app is actually present
ERROR: debug: Checking whether adb is present
ERROR: debug: Using adb from C:\Android\android-sdk\platform-tools\adb.exe
ERROR: debug: Trying to find a connected android device
ERROR: debug: Getting connected devices…
ERROR: debug: executing: “C:\Android\android-sdk\platform-tools\adb.exe” devices
ERROR: debug: Could not find devices, restarting adb server…
ERROR: debug: executing: “C:\Android\android-sdk\platform-tools\adb.exe” kill-server
warn: code=ENOENT, errno=ENOENT, syscall=spawn
ERROR: error: Error killing ADB server, going to see if it’s online anyway
warn: code=ENOENT, errno=ENOENT, syscall=spawn
ERROR: debug: Getting connected devices…
ERROR: debug: executing: “C:\Android\android-sdk\platform-tools\adb.exe” devices
ERROR: debug: Could not find devices, restarting adb server…
ERROR: debug: executing: “C:\Android\android-sdk\platform-tools\adb.exe” kill-server
warn: code=ENOENT, errno=ENOENT, syscall=spawn
ERROR: error: Error killing ADB server, going to see if it’s online anyway
warn: code=ENOENT, errno=ENOENT, syscall=spawn
ERROR: debug: Getting connected devices…
ERROR: debug: executing: “C:\Android\android-sdk\platform-tools\adb.exe” devices
ERROR: debug: Sent shutdown command, waiting for UiAutomator to stop…
warn: UiAutomator did not shut down fast enough, calling it gone
ERROR:
Node Server Process Ended

Solution: After trying various JDK, Appium and ADB versions one small thing fixed the problem and it was adding system32 location “%SystemRoot%\system32” as PATH variable under System variables. Basically appium might need something system32 directory to interact with adb command during run time.

To add system32 as PATH, go to System Properties >> Environment Variables >> System Variables, and add or edit PATH variable add “%SystemRoot%\system32” (without quotes) and save it then Restart the machine once.
Add system32 path in PATH variables
Launch appium now and you would be able to see all the AVD’s listed in the drop down :) I am happy to help with any appium configuration issues you have, just mention them in the comment section below.

Related Posts:

0 comments:

Post a Comment

ads