Getting error ::: ERROR running Appium command: This method requires that a device ID is set.

1,791 views
Skip to first unread message

Gulshan Saini

unread,
Jul 25, 2013, 5:44:35 AM7/25/13
to appium-...@googlegroups.com
Hi

I am getting following error. Below are logs appium console and eclipse.

Please help me resolving issue.

Thanks
Gulshan


info: Could not find devices, restarting adb server...
info: Killing ADB server so it will come back online
error: Error killing ADB server, going to see if it's online anyway
info: [ADB] Getting connected devices...
debug: Appium request initiated at /wd/hub/session
debug: Request received with params: {"desiredCapabilities":{"platform":"Windows
","app":"F:\\android-apidemos-master\\bin\\ApiDemos.apk","app-package":"com.exam
ple.android.apis","device":"Android","app-wait-activity":"ApiDemos","app-activit
y":"ApiDemos","version":"4.2.2"}}
info: Using local app from desiredCaps: F:\android-apidemos-master\bin\ApiDemos.
apk
POST /wd/hub/session 500 17ms - 148
Error: This method requires that a device ID is set. Call getConnectedDevices or
 setDeviceId
    at ADB.requireDeviceId (C:\Appium\node_modules\appium\android\adb.js:897:11)

    at ADB.goToHome (C:\Appium\node_modules\appium\android\adb.js:1307:8)
    at Android.stop (C:\Appium\node_modules\appium\app\android.js:174:14)
    at Appium.clearPreviousSession (C:\Appium\node_modules\appium\app\appium.js:
399:15)
    at null.<anonymous> (C:\Appium\node_modules\appium\app\appium.js:108:12)
    at Appium.configureLocalApp (C:\Appium\node_modules\appium\app\appium.js:273
:5)
    at Appium.configureApp (C:\Appium\node_modules\appium\app\appium.js:239:10)
    at Appium.configure (C:\Appium\node_modules\appium\app\appium.js:215:10)
    at Appium.start (C:\Appium\node_modules\appium\app\appium.js:102:8)
    at exports.createSession (C:\Appium\node_modules\appium\app\controller.js:17
7:16)




Initializing...
Setting Capabilities...
Launching Remote Webdriver
Exception in thread "main" org.openqa.selenium.WebDriverException: ERROR running Appium command: This method requires that a device ID is set. Call getConnectedDevices or setDeviceId
Command duration or timeout: 122.21 seconds
Build info: version: '2.31.0', revision: '1bd294d', time: '2013-02-27 20:52:59'
System info: os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.6.0_27'
Driver info: org.openqa.selenium.remote.RemoteWebDriver
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:187)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:554)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:216)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:111)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:129)
at com.test.appium.sample.AppiumLaunchTest.main(AppiumLaunchTest.java:28)

Aniket Gadre

unread,
Jul 25, 2013, 5:46:51 AM7/25/13
to Gulshan Saini, appium-...@googlegroups.com
It seems appium is not able to find your device. Are you using an emulator or physical device? Try restarting ADB 



--
http://appium.io
---
You received this message because you are subscribed to the Google Groups "Appium-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to appium-discus...@googlegroups.com.
Visit this group at http://groups.google.com/group/appium-discuss.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Best Regards,
Aniket Gadre
Test Automation Lead
Amdocs , Pune.
E-add: aniket...@amdocs.com

Gulshan Saini

unread,
Jul 25, 2013, 6:07:20 AM7/25/13
to appium-...@googlegroups.com
I am using emulator. I already restarted adb


Thanks
Gulshan

Aniket Gadre

unread,
Jul 25, 2013, 6:41:22 AM7/25/13
to Gulshan Saini, appium-...@googlegroups.com
What message do you get when you run "adb devices"?


--
http://appium.io
---
You received this message because you are subscribed to the Google Groups "Appium-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to appium-discus...@googlegroups.com.
Visit this group at http://groups.google.com/group/appium-discuss.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Gulshan Saini

unread,
Jul 25, 2013, 7:12:41 AM7/25/13
to appium-...@googlegroups.com, Gulshan Saini
I am getting following msg


C:\Users\gulshan.saini>adb devices
List of devices attached
emulator-5554   device

SCBhupen

unread,
Jul 25, 2013, 8:08:25 AM7/25/13
to Gulshan Saini, appium-...@googlegroups.com
Try to use below steps, this might helps you …

1: Open terminal and start your emulator 
emulator -avd <emulatorName>

2: Open another terminal kill the dab server
adb kill-server

3: Start the adb server
adb start-server

4: check your device connected or not
adb devices



Thanks
Bhupen




Gulshan Saini

unread,
Jul 25, 2013, 8:20:16 AM7/25/13
to appium-...@googlegroups.com, Gulshan Saini
Ok, as said I performed all steps and below is output

C:\Users\gulshan.saini>emulator -avd avd-2

C:\Users\gulshan.saini>adb kill-server

C:\Users\gulshan.saini>adb start-server
* daemon not running. starting it now on port 5037 *
* daemon started successfully *

C:\Users\gulshan.saini>adb devices
List of devices attached
emulator-5554   device


C:\Users\gulshan.saini>


------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

I again tried running my test and again i am getting same kind of error

I also see following errors on DDMS console, not sure are they related to my test or not

[2013-07-25 17:44:49 - DeviceMonitor] Adb connection Error:An existing connection was forcibly closed by the remote host
[2013-07-25 17:44:50 - DeviceMonitor] Connection attempts: 1
[2013-07-25 17:44:51 - ddmlib] An established connection was aborted by the software in your host machine
java.io.IOException: An established connection was aborted by the software in your host machine
at sun.nio.ch.SocketDispatcher.write0(Native Method)
at sun.nio.ch.SocketDispatcher.write(Unknown Source)
at sun.nio.ch.IOUtil.writeFromNativeBuffer(Unknown Source)
at sun.nio.ch.IOUtil.write(Unknown Source)
at sun.nio.ch.SocketChannelImpl.write(Unknown Source)
at com.android.ddmlib.JdwpPacket.writeAndConsume(JdwpPacket.java:213)
at com.android.ddmlib.Client.sendAndConsume(Client.java:607)
at com.android.ddmlib.HandleHeap.sendREAQ(HandleHeap.java:348)
at com.android.ddmlib.Client.requestAllocationStatus(Client.java:453)
at com.android.ddmlib.DeviceMonitor.createClient(DeviceMonitor.java:835)
at com.android.ddmlib.DeviceMonitor.openClient(DeviceMonitor.java:803)
at com.android.ddmlib.DeviceMonitor.processIncomingJdwpData(DeviceMonitor.java:763)
at com.android.ddmlib.DeviceMonitor.deviceClientMonitorLoop(DeviceMonitor.java:652)
at com.android.ddmlib.DeviceMonitor.access$100(DeviceMonitor.java:44)
at com.android.ddmlib.DeviceMonitor$3.run(DeviceMonitor.java:580)

also on Appium console I am getting same error

info: Welcome to Appium v0.7.1 (REV 055dcdf7ef1915a0a15a4bc9daed1c748c98f2fa)
info: Appium REST http interface listener started on 127.0.0.1:4723
   info  - socket.io started
debug: Appium request initiated at /wd/hub/session
debug: Request received with params: {"desiredCapabilities":{"platform":"Windows
","app":"F:\\android-apidemos-master\\bin\\ApiDemos.apk","browserName":"Android"
,"app-package":"com.example.android.apis","device":"Android","app-wait-activity"
:"ApiDemos","app-activity":"ApiDemos","version":"4.2.2"}}
info: Using local app from desiredCaps: F:\android-apidemos-master\bin\ApiDemos.
apk
info: Creating new appium session f4c1357b-d233-40d6-a678-e50b1a8b6106
info: Starting android appium
debug: Using fast reset? false
info: Preparing device for session
info: Checking whether app is actually present
info: Checking whether adb is present
info: [ADB] Using adb from C:\AndroidBundle\sdk\platform-tools\adb.exe
info: Trying to find a connected android device
info: [ADB] Getting connected devices...
error: Error: Command failed: The system cannot find the path specified.

info: Could not find devices, restarting adb server...
info: Killing ADB server so it will come back online
error: Error killing ADB server, going to see if it's online anyway
info: [ADB] Getting connected devices...
debug: Appium request initiated at /wd/hub/session
debug: Request received with params: {"desiredCapabilities":{"platform":"Windows
","app":"F:\\android-apidemos-master\\bin\\ApiDemos.apk","browserName":"Android"
,"app-package":"com.example.android.apis","device":"Android","app-wait-activity"
:"ApiDemos","app-activity":"ApiDemos","version":"4.2.2"}}
info: Using local app from desiredCaps: F:\android-apidemos-master\bin\ApiDemos.
apk
POST /wd/hub/session 500 9ms - 148

Gulshan Saini

unread,
Jul 25, 2013, 8:24:36 AM7/25/13
to appium-...@googlegroups.com, Gulshan Saini

also below is snapshot of appium app.

and sample program 

File app = new File("F:/android-apidemos-master/bin/ApiDemos.apk");

System.out.println("Initializing...");

DesiredCapabilities capabilities = new DesiredCapabilities();

System.out.println("Setting Capabilities...");

capabilities.setCapability("device", "Android");

capabilities.setCapability(CapabilityType.BROWSER_NAME, "Android");

capabilities.setCapability(CapabilityType.VERSION, "4.2.2");

capabilities.setCapability(CapabilityType.PLATFORM, "Windows");

//This is path of your application

capabilities.setCapability("app", app.getAbsolutePath());

// This is package name of your app

capabilities.setCapability("app-package", "com.example.android.apis");

// This Launcher activity of your app

capabilities.setCapability("app-wait-activity", "ApiDemos");

capabilities.setCapability("app-activity", "ApiDemos");

System.out.println("Launching Remote Webdriver");

RemoteWebDriver remoteWebDriver = new RemoteWebDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);

SCBhupen

unread,
Jul 25, 2013, 10:21:18 AM7/25/13
to Gulshan Saini, appium-...@googlegroups.com
Did you set $ANDROID_HOME and dab in your $PATH?

Thanks
Bhupen




Gulshan Saini

unread,
Jul 25, 2013, 10:58:26 AM7/25/13
to appium-...@googlegroups.com, Gulshan Saini
C:\Users\Gulshan Saini>echo %ANDROID_HOME%
C:\Android\sdk

Below are the details

C:\Users\Gulshan Saini>echo %PATH%
C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\apache-ant-1.8.2\bin;C:\apache-maven-3.0.3\bin;%JAVA_HOME%\bin;%M2_HOME%\bin;C:\Program Files\nodejs\;C:\Android\sdk\platform-tools;C:\Android\sdk\tools

Jonathan Lipps

unread,
Jul 25, 2013, 5:01:50 PM7/25/13
to Gulshan Saini, appium-...@googlegroups.com
I don't know windows, but is the fact that these are on different partitions (C:\ vs F:\) important?

It looks like Appium isn't reading the output of adb, or the output when run under appium is not the same as when you run it yourself.

Gulshan Saini

unread,
Jul 26, 2013, 3:28:56 AM7/26/13
to appium-...@googlegroups.com, Gulshan Saini
Not sure what exacly the problem was.

I tried on different machine having same configuration and settings and it worked...


Thanks for all help guys.....This is still mystery :)

Santiago Hernández

unread,
Oct 16, 2013, 6:44:52 PM10/16/13
to appium-...@googlegroups.com
I am having the same issue... 

Exactly the same, and it is working on other pc, the only difference is that where it is not working I have windows in spanish.
Reply all
Reply to author
Forward
0 new messages