Original error: unknown error: Device is not online

I am getting this error while trying to connect chrome driver in Android device . I have tried all the possibilities sorted out in this forum . Still the error persists .

 org.openqa.selenium.SessionNotCreatedException: 
 A new session could not be created. (Original error: An unknown server-side error occurred while           processing the command. (Original error: unknown error: Device ZY222Z37Z2 is not online

And My code

      DesiredCapabilities capabilities = DesiredCapabilities.android();
	capabilities.setCapability(MobileCapabilityType.BROWSER_NAME, BrowserType.CHROME);
	capabilities.setCapability(MobileCapabilityType.PLATFORM, Platform.ANDROID);
	capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android");
	capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "ZY222Z37Z2");
	capabilities.setCapability(MobileCapabilityType.VERSION, "6.0.1");
	
	URL url=new URL("http://127.0.0.2:4925/wd/hub");
	
	driver=new AndroidDriver(url,capabilities);

Can anyone help me with this .

Appium version - 1.4.16.1

Check the output of the command “adb devices”. It should show something like:

List of devices attached
076a97046217dd64 device

If it shows this instead:

List of devices attached
076a97032517dd64 offline

Then you need to enable access to this device from this computer. The device should show you a popup as described on this page: http://www.howtogeek.com/125769/how-to-install-and-use-abd-the-android-debug-bridge-utility/ under this section “Enable USB Debugging on Your Phone”

If you don’t get that popup, try disabling USB access from the menu then re-enable after a few seconds and the popup should be displayed. Click the checkbox to always use this setting.

Here is my code … adb can able to my identify device …

info: [debug] Getting connected devices…
info: [debug] executing cmd: D:\android-sdk-windows\platform-tools\adb.exe devices
info: [debug] 1 device(s) connected
info: Found device ZY222Z37Z2
info: [debug] Setting device id to ZY222Z37Z2
info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)
info: [debug] executing cmd: D:\android-sdk-windows\platform-tools\adb.exe -s ZY222Z37Z2 wait-for-device
info: [debug] executing cmd: D:\android-sdk-windows\platform-tools\adb.exe -s ZY222Z37Z2 shell “echo ‘ready’”
info: [debug] Starting logcat capture
info: [debug] Pushing unlock helper app to device…
info: [debug] executing cmd: D:\android-sdk-windows\platform-tools\adb.exe -s ZY222Z37Z2 install “C:\Program Files (x86)\Appium\node_modules\appium\build\unlock_apk\unlock_apk-debug.apk”
info: [debug] executing cmd: D:\android-sdk-windows\platform-tools\adb.exe -s ZY222Z37Z2 shell “dumpsys window”
info: [debug] Screen already unlocked, continuing.
info: [debug] Forwarding system:4724 to device:4724
info: [debug] executing cmd: D:\android-sdk-windows\platform-tools\adb.exe -s ZY222Z37Z2 forward tcp:4724 tcp:4724
info: [debug] Pushing appium bootstrap to device…
info: [debug] executing cmd: D:\android-sdk-windows\platform-tools\adb.exe -s ZY222Z37Z2 push “C:\Program Files (x86)\Appium\node_modules\appium\build\android_bootstrap\AppiumBootstrap.jar” /data/local/tmp/
info: Starting App
info: [debug] Attempting to kill all ‘uiautomator’ processes
info: [debug] Getting all processes with ‘uiautomator’
info: [debug] executing cmd: D:\android-sdk-windows\platform-tools\adb.exe -s ZY222Z37Z2 shell “ps ‘uiautomator’”
info: [debug] No matching processes found
info: [debug] Running bootstrap
info: [debug] spawning: D:\android-sdk-windows\platform-tools\adb.exe -s ZY222Z37Z2 shell uiautomator runtest AppiumBootstrap.jar -c io.appium.android.bootstrap.Bootstrap -e pkg com.android.chrome -e disableAndroidWatchers false
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=
info: [debug] [UIAUTOMATOR STDOUT] io.appium.android.bootstrap.Bootstrap:
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: 1
info: [debug] [BOOTSTRAP] [debug] Socket opened on port 4724
info: [debug] [BOOTSTRAP] [debug] Appium Socket Server Ready
info: [debug] [BOOTSTRAP] [debug] Loading json…
info: [debug] Pushing command to appium work queue: [“getDataDir”,{}]
info: [debug] [BOOTSTRAP] [debug] json loading complete.
info: [debug] [BOOTSTRAP] [debug] Registered crash watchers.
info: [debug] [BOOTSTRAP] [debug] Client connected
info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“action”,“action”:“getDataDir”,“params”:{}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: getDataDir
info: [debug] dataDir set to: /data/local/tmp
info: Chromedriver: Changed state to ‘starting’
info: [debug] [BOOTSTRAP] [debug] Returning result: {“status”:0,“value”:“/data/local/tmp”}
info: Chromedriver: Set chromedriver binary as: C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-chromedriver\chromedriver\win\chromedriver.exe
info: Chromedriver: Killing any old chromedrivers, running: FOR /F “usebackq tokens=5” %a in (netstat -nao ^| findstr /R /C:"9515 ") do (FOR /F “usebackq” %b in (TASKLIST /FI "PID eq %a" ^| findstr /I chromedriver.exe) do (IF NOT %b==“” TASKKILL /F /PID %a))
info: Chromedriver: No old chromedrivers seemed to exist
info: Chromedriver: Spawning chromedriver with: C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-chromedriver\chromedriver\win\chromedriver.exe --url-base=wd/hub --port=9515
info: Chromedriver: [STDOUT] Starting ChromeDriver 2.18.343845 (73dd713ba7fbfb73cbb514e62641d8c96a94682a) on port 9515
Only local connections are allowed.
info: JSONWP Proxy: Proxying [GET /status] to [GET http://127.0.0.1:9515/wd/hub/status] with no body
error: Chromedriver: Chromedriver exited unexpectedly with code null, signal SIGTERM
info: Chromedriver: Changed state to ‘stopped’
info: Chromedriver stopped unexpectedly on us, shutting down then calling back up with the on-die callback
error: Chromedriver: Error: An unknown server-side error occurred while processing the command. (Original error: unknown error: Device ZY222Z37Z2 is not online
(Driver info: chromedriver=2.18.343845 (73dd713ba7fbfb73cbb514e62641d8c96a94682a),platform=Windows NT 6.3 x86_64))
at JWProxy.command$ (lib/proxy.js:133:15)
at tryCatch (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-chromedriver\node_modules\appium-jsonwp-proxy\node_modules\babel-runtime\regenerator\runtime.js:67:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-chromedriver\node_modules\appium-jsonwp-proxy\node_modules\babel-runtime\regenerator\runtime.js:315:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-chromedriver\node_modules\appium-jsonwp-proxy\node_modules\babel-runtime\regenerator\runtime.js:100:21)
at GeneratorFunctionPrototype.invoke (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-chromedriver\node_modules\appium-jsonwp-proxy\node_modules\babel-runtime\regenerator\runtime.js:136:37)
at bound (domain.js:284:14)
at GeneratorFunctionPrototype.runBound (domain.js:297:12)
at run (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-chromedriver\node_modules\appium-jsonwp-proxy\node_modules\babel-runtime\node_modules\core-js\library\modules\es6.promise.js:89:39)
at C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-chromedriver\node_modules\appium-jsonwp-proxy\node_modules\babel-runtime\node_modules\core-js\library\modules\es6.promise.js:100:28
at flush (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-chromedriver\node_modules\appium-jsonwp-proxy\node_modules\babel-runtime\node_modules\core-js\library\modules$.microtask.js:17:13)
at process._tickDomainCallback (node.js:381:11)
{ [Error: An unknown server-side error occurred while processing the command. (Original error: unknown error: Device ZY222Z37Z2 is not online
(Driver info: chromedriver=2.18.343845 (73dd713ba7fbfb73cbb514e62641d8c96a94682a),platform=Windows NT 6.3 x86_64))]
status: 13,
value: { message: ‘unknown error: Device ZY222Z37Z2 is not online\n (Driver info: chromedriver=2.18.343845 (73dd713ba7fbfb73cbb514e62641d8c96a94682a),platform=Windows NT 6.3 x86_64)’ },
httpCode: 200 }
info: [debug] Cleaning up appium session
error: Failed to start an Appium session, err was: Error: An unknown server-side error occurred while processing the command. (Original error: unknown error: Device ZY222Z37Z2 is not online
(Driver info: chromedriver=2.18.343845 (73dd713ba7fbfb73cbb514e62641d8c96a94682a),platform=Windows NT 6.3 x86_64))
info: [debug] Error: An unknown server-side error occurred while processing the command. (Original error: unknown error: Device ZY222Z37Z2 is not online
(Driver info: chromedriver=2.18.343845 (73dd713ba7fbfb73cbb514e62641d8c96a94682a),platform=Windows NT 6.3 x86_64))
at JWProxy.command$ (lib/proxy.js:133:15)
at tryCatch (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-chromedriver\node_modules\appium-jsonwp-proxy\node_modules\babel-runtime\regenerator\runtime.js:67:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-chromedriver\node_modules\appium-jsonwp-proxy\node_modules\babel-runtime\regenerator\runtime.js:315:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-chromedriver\node_modules\appium-jsonwp-proxy\node_modules\babel-runtime\regenerator\runtime.js:100:21)
at GeneratorFunctionPrototype.invoke (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-chromedriver\node_modules\appium-jsonwp-proxy\node_modules\babel-runtime\regenerator\runtime.js:136:37)
at bound (domain.js:284:14)
at GeneratorFunctionPrototype.runBound (domain.js:297:12)
at run (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-chromedriver\node_modules\appium-jsonwp-proxy\node_modules\babel-runtime\node_modules\core-js\library\modules\es6.promise.js:89:39)
at C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-chromedriver\node_modules\appium-jsonwp-proxy\node_modules\babel-runtime\node_modules\core-js\library\modules\es6.promise.js:100:28
at flush (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-chromedriver\node_modules\appium-jsonwp-proxy\node_modules\babel-runtime\node_modules\core-js\library\modules$.microtask.js:17:13)
at process._tickDomainCallback (node.js:381:11)
info: [debug] Responding to client with error: {“status”:33,“value”:{“message”:“A new session could not be created. (Original error: An unknown server-side error occurred while processing the command. (Original error: unknown error: Device ZY222Z37Z2 is not online\n (Driver info: chromedriver=2.18.343845 (73dd713ba7fbfb73cbb514e62641d8c96a94682a),platform=Windows NT 6.3 x86_64)))”,“status”:13,“value”:{“message”:“unknown error: Device ZY222Z37Z2 is not online\n (Driver info: chromedriver=2.18.343845 (73dd713ba7fbfb73cbb514e62641d8c96a94682a),platform=Windows NT 6.3 x86_64)”},“httpCode”:200,“origValue”:“An unknown server-side error occurred while processing the command. (Original error: unknown error: Device ZY222Z37Z2 is not online\n (Driver info: chromedriver=2.18.343845 (73dd713ba7fbfb73cbb514e62641d8c96a94682a),platform=Windows NT 6.3 x86_64))”},“sessionId”:null}

Btw “Thanks for your response” …

Have U solve this problem? when I switch context, i got the same issue