Script is working with emulator but not with real device

DesiredCapabilities capabilites = new DesiredCapabilities();

	capabilites.setCapability("automationName", "Appium");
	capabilites.setCapability("platformName", "Android");
	capabilites.setCapability("platformVersion", "5.1.1");
	capabilites.setCapability("deviceName", "Android Emulator");
	capabilites.setCapability("app", "C:\\Users\\ASHUTOSH\\Downloads\\selendroid-test-app-0.17.0.apk");
	capabilites.setCapability("appPackage", "io.selendroid.testapp");
	capabilites.setCapability("appActivity", "io.selendroid.testapp.HomeScreenActivity");
	
	AndroidDriver driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilites);
	driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
    driver.findElement(By.xpath("//android.widget.Button[@index='1']")).click();

DesiredCapabilities capabilites = new DesiredCapabilities();

	capabilites.setCapability("automationName", "Appium");
	capabilites.setCapability("platformName", "Android");
	capabilites.setCapability("platformVersion", "6.0.1");
	capabilites.setCapability("deviceName", "Redmi");
	capabilites.setCapability("app", "C:\\Users\\ASHUTOSH\\Downloads\\selendroid-test-app-0.17.0.apk");
	capabilites.setCapability("appPackage", "io.selendroid.testapp");
	capabilites.setCapability("appActivity", "io.selendroid.testapp.HomeScreenActivity");
	
	AndroidDriver driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilites);
	driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
    driver.findElement(By.xpath("//android.widget.Button[@index='1']")).click();

Can anyone check what can be the reason,

What error does the Appium Server show?
Does your tethered device show up when you type “adb devices”?
Make sure the name that shows up from “adb devices” is what you use for your deviceName.

Thanks Doug,

Killed Node Server.
Appium server process ended
Launching Appium server with command: C:\Program Files (x86)\Appium\node.exe lib\server\main.js --address 127.0.0.1 --port 4723 --platform-name Android --platform-version 23 --automation-name Appium --log-no-color
warn: Appium support for versions of node < 0.12 has been deprecated and will be removed in a future version. Please upgrade!
info: Welcome to Appium v1.4.13 (REV c75d8adcb66a75818a542fe1891a34260c21f76a)
info: Appium REST http interface listener started on 127.0.0.1:4723
info: [debug] Non-default server args: {“address”:“127.0.0.1”,“logNoColors”:true,“platformName”:“Android”,“platformVersion”:“23”,“automationName”:“Appium”}
info: Console LogLevel: debug
info: → POST /wd/hub/session {“capabilities”:[{“desiredCapabilities”:{“app”:“C:\Users\ASHUTOSH\Downloads\selendroid-test-app-0.17.0.apk”,“appPackage”:“io.selendroid.testapp”,“appActivity”:“io.selendroid.testapp.HomeScreenActivity”,“platformVersion”:“6.0.1”,“automationName”:“Appium”,“platformName”:“Android”,“deviceName”:“57da3ec0”}},{“requiredCapabilities”:{}}],“desiredCapabilities”:{“app”:“C:\Users\ASHUTOSH\Downloads\selendroid-test-app-0.17.0.apk”,“appPackage”:“io.selendroid.testapp”,“appActivity”:“io.selendroid.testapp.HomeScreenActivity”,“platformVersion”:“6.0.1”,“automationName”:“Appium”,“platformName”:“Android”,“deviceName”:“57da3ec0”},“requiredCapabilities”:{}}
info: Client User-Agent string: Apache-HttpClient/4.5.3 (Java/1.8.0_131)
info: [debug] Using local app from desired caps: C:\Users\ASHUTOSH\Downloads\selendroid-test-app-0.17.0.apk
info: [debug] Creating new appium session 0bbe504d-b306-485a-83fe-807442e5358b
info: Starting android appium
info: [debug] Getting Java version
info: Java version is: 1.8.0_131
info: [debug] Checking whether adb is present
info: [debug] Using adb from C:\Program Files (x86)\Android\android-sdk\tools\adb.exe
info: [debug] Using fast reset? true
info: [debug] Preparing device for session
info: [debug] Checking whether app is actually present
info: Retrieving device
info: [debug] Trying to find a connected android device
info: [debug] Getting connected devices…
info: [debug] executing cmd: “C:\Program Files (x86)\Android\android-sdk\tools\adb.exe” devices
info: [debug] 1 device(s) connected
info: Found device 57da3ec0
info: [debug] Setting device id to 57da3ec0
info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)
info: [debug] executing cmd: “C:\Program Files (x86)\Android\android-sdk\tools\adb.exe” -s 57da3ec0 wait-for-device
info: [debug] executing cmd: “C:\Program Files (x86)\Android\android-sdk\tools\adb.exe” -s 57da3ec0 shell “echo ‘ready’”
info: [debug] Starting logcat capture
info: [debug] Getting device API level
info: [debug] executing cmd: “C:\Program Files (x86)\Android\android-sdk\tools\adb.exe” -s 57da3ec0 shell “getprop ro.build.version.sdk”
info: [debug] Device is at API Level 23
info: Device API level is: 23
info: [debug] Extracting strings for language: default
info: [debug] executing cmd: “C:\Program Files (x86)\Android\android-sdk\tools\adb.exe” -s 57da3ec0 shell “getprop persist.sys.language”
info: [debug] Current device persist.sys.language:
info: [debug] java -jar “C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\jars\appium_apk_tools.jar” “stringsFromApk” “C:\Users\ASHUTOSH\Downloads\selendroid-test-app-0.17.0.apk” “C:\Users\ASHUTOSH\AppData\Local\Temp\io.selendroid.testapp”
info: [debug] Reading strings from converted strings.json
info: [debug] Setting language to default
info: [debug] executing cmd: “C:\Program Files (x86)\Android\android-sdk\tools\adb.exe” -s 57da3ec0 push “C:\Users\ASHUTOSH\AppData\Local\Temp\io.selendroid.testapp\strings.json” /data/local/tmp
info: [debug] Checking whether aapt is present
info: [debug] Using aapt from C:\Program Files (x86)\Android\android-sdk\build-tools\25.0.2\aapt.exe
info: [debug] Retrieving process from manifest.
info: [debug] executing cmd: “C:\Program Files (x86)\Android\android-sdk\build-tools\25.0.2\aapt.exe” dump xmltree C:\Users\ASHUTOSH\Downloads\selendroid-test-app-0.17.0.apk AndroidManifest.xml
info: [debug] Set app process to: io.selendroid.testapp
info: [debug] Not uninstalling app since server not started with --full-reset
info: [debug] Checking app cert for C:\Users\ASHUTOSH\Downloads\selendroid-test-app-0.17.0.apk.
info: [debug] executing cmd: java -jar “C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\jars\verify.jar” C:\Users\ASHUTOSH\Downloads\selendroid-test-app-0.17.0.apk
info: [debug] App already signed.
info: [debug] Zip-aligning C:\Users\ASHUTOSH\Downloads\selendroid-test-app-0.17.0.apk
info: [debug] Checking whether zipalign is present
info: [debug] Using zipalign from C:\Program Files (x86)\Android\android-sdk\build-tools\25.0.2\zipalign.exe
info: [debug] Zip-aligning apk.
info: [debug] executing cmd: “C:\Program Files (x86)\Android\android-sdk\build-tools\25.0.2\zipalign.exe” -f 4 C:\Users\ASHUTOSH\Downloads\selendroid-test-app-0.17.0.apk C:\Users\ASHUTOSH\AppData\Local\Temp\11741-3016-5hxzpb\appium.tmp
info: [debug] MD5 for app is d6d43218105a4e0ccabfb58bb04f24af
info: [debug] executing cmd: “C:\Program Files (x86)\Android\android-sdk\tools\adb.exe” -s 57da3ec0 shell “ls /data/local/tmp/d6d43218105a4e0ccabfb58bb04f24af.apk”
info: [debug] Getting install status for io.selendroid.testapp
info: [debug] Getting device API level
info: [debug] executing cmd: “C:\Program Files (x86)\Android\android-sdk\tools\adb.exe” -s 57da3ec0 shell “getprop ro.build.version.sdk”
info: [debug] Device is at API Level 23
info: [debug] executing cmd: “C:\Program Files (x86)\Android\android-sdk\tools\adb.exe” -s 57da3ec0 shell “pm list packages -3 io.selendroid.testapp”
info: [debug] App is installed
info: Installing App
info: [debug] executing cmd: “C:\Program Files (x86)\Android\android-sdk\tools\adb.exe” -s 57da3ec0 shell “mkdir -p /data/local/tmp/”
info: [debug] Removing any old apks
info: [debug] executing cmd: “C:\Program Files (x86)\Android\android-sdk\tools\adb.exe” -s 57da3ec0 shell “ls /data/local/tmp/*.apk”
info: [debug] executing cmd: “C:\Program Files (x86)\Android\android-sdk\tools\adb.exe” -s 57da3ec0 shell rm “/data/local/tmp/5d99cc8c27732cc28ef8441aae656dc4.apk”
info: [debug] executing cmd: “C:\Program Files (x86)\Android\android-sdk\tools\adb.exe” -s 57da3ec0 push “C:\Users\ASHUTOSH\Downloads\selendroid-test-app-0.17.0.apk” /data/local/tmp/d6d43218105a4e0ccabfb58bb04f24af.apk
info: [debug] Uninstalling io.selendroid.testapp
info: [debug] executing cmd: “C:\Program Files (x86)\Android\android-sdk\tools\adb.exe” -s 57da3ec0 shell “am force-stop io.selendroid.testapp”
info: [debug] executing cmd: “C:\Program Files (x86)\Android\android-sdk\tools\adb.exe” -s 57da3ec0 uninstall io.selendroid.testapp
info: [debug] App was uninstalled
info: [debug] executing cmd: “C:\Program Files (x86)\Android\android-sdk\tools\adb.exe” -s 57da3ec0 shell “pm install -r /data/local/tmp/d6d43218105a4e0ccabfb58bb04f24af.apk”
info: [debug] Forwarding system:4724 to device:4724
info: [debug] executing cmd: “C:\Program Files (x86)\Android\android-sdk\tools\adb.exe” -s 57da3ec0 forward tcp:4724 tcp:4724
info: [debug] Pushing appium bootstrap to device…
info: [debug] executing cmd: “C:\Program Files (x86)\Android\android-sdk\tools\adb.exe” -s 57da3ec0 push “C:\Program Files (x86)\Appium\node_modules\appium\build\android_bootstrap\AppiumBootstrap.jar” /data/local/tmp/
info: [debug] Pushing settings apk to device…
info: [debug] executing cmd: “C:\Program Files (x86)\Android\android-sdk\tools\adb.exe” -s 57da3ec0 install “C:\Program Files (x86)\Appium\node_modules\appium\build\settings_apk\settings_apk-debug.apk”
info: [debug] Pushing unlock helper app to device…
info: [debug] executing cmd: “C:\Program Files (x86)\Android\android-sdk\tools\adb.exe” -s 57da3ec0 install “C:\Program Files (x86)\Appium\node_modules\appium\build\unlock_apk\unlock_apk-debug.apk”
info: Starting App
info: [debug] Attempting to kill all ‘uiautomator’ processes
info: [debug] Getting all processes with ‘uiautomator’
info: [debug] executing cmd: “C:\Program Files (x86)\Android\android-sdk\tools\adb.exe” -s 57da3ec0 shell “ps ‘uiautomator’”
info: [debug] No matching processes found
info: [debug] Running bootstrap
info: [debug] spawning: C:\Program Files (x86)\Android\android-sdk\tools\adb.exe -s 57da3ec0 shell uiautomator runtest AppiumBootstrap.jar -c io.appium.android.bootstrap.Bootstrap -e pkg io.selendroid.testapp -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] Waking up device if it’s not alive
info: [debug] Pushing command to appium work queue: [“wake”,{}]
info: [debug] [BOOTSTRAP] [debug] Loading json…
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”:“wake”,“params”:{}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: wake
info: [debug] [BOOTSTRAP] [debug] Returning result: {“status”:0,“value”:true}
info: [debug] executing cmd: “C:\Program Files (x86)\Android\android-sdk\tools\adb.exe” -s 57da3ec0 shell “dumpsys window”
info: [debug] Screen already unlocked, continuing.
info: [debug] Pushing command to appium work queue: [“getDataDir”,{}]
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] [BOOTSTRAP] [debug] Returning result: {“status”:0,“value”:“/data/local/tmp”}
info: [debug] dataDir set to: /data/local/tmp
info: [debug] Pushing command to appium work queue: [“compressedLayoutHierarchy”,{“compressLayout”:false}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“action”,“action”:“compressedLayoutHierarchy”,“params”:{“compressLayout”:false}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: compressedLayoutHierarchy
info: [debug] [BOOTSTRAP] [debug] Returning result: {“status”:0,“value”:false}
info: [debug] Getting device API level
info: [debug] executing cmd: “C:\Program Files (x86)\Android\android-sdk\tools\adb.exe” -s 57da3ec0 shell “getprop ro.build.version.sdk”
info: [debug] Device is at API Level 23
info: [debug] executing cmd: “C:\Program Files (x86)\Android\android-sdk\tools\adb.exe” -s 57da3ec0 shell “am start -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000 -n io.selendroid.testapp/io.selendroid.testapp.HomeScreenActivity”
info: [debug] Waiting for pkg “io.selendroid.testapp” and activity “io.selendroid.testapp.HomeScreenActivity” to be focused
info: [debug] Getting focused package and activity
info: [debug] executing cmd: “C:\Program Files (x86)\Android\android-sdk\tools\adb.exe” -s 57da3ec0 shell “dumpsys window windows”
info: [debug] executing cmd: “C:\Program Files (x86)\Android\android-sdk\tools\adb.exe” -s 57da3ec0 shell “getprop ro.build.version.release”
info: [debug] Device is at release version 6.0.1
info: [debug] Device launched! Ready for commands
info: [debug] Setting command timeout to the default of 60 secs
info: [debug] Appium session started with sessionId 0bbe504d-b306-485a-83fe-807442e5358b
info: ← POST /wd/hub/session 303 24195.256 ms - 74
info: → GET /wd/hub/session/0bbe504d-b306-485a-83fe-807442e5358b {}
info: [debug] Responding to client with success: {“status”:0,“value”:{“platform”:“LINUX”,“browserName”:“Android”,“platformVersion”:“6.0.1”,“webStorageEnabled”:false,“takesScreenshot”:true,“javascriptEnabled”:true,“databaseEnabled”:false,“networkConnectionEnabled”:true,“locationContextEnabled”:false,“warnings”:{},“desired”:{“app”:“C:\Users\ASHUTOSH\Downloads\selendroid-test-app-0.17.0.apk”,“appPackage”:“io.selendroid.testapp”,“appActivity”:“io.selendroid.testapp.HomeScreenActivity”,“platformVersion”:“6.0.1”,“automationName”:“Appium”,“platformName”:“Android”,“deviceName”:“57da3ec0”},“app”:“C:\Users\ASHUTOSH\Downloads\selendroid-test-app-0.17.0.apk”,“appPackage”:“io.selendroid.testapp”,“appActivity”:“io.selendroid.testapp.HomeScreenActivity”,“automationName”:“Appium”,“platformName”:“Android”,“deviceName”:“57da3ec0”},“sessionId”:“0bbe504d-b306-485a-83fe-807442e5358b”}
info: ← GET /wd/hub/session/0bbe504d-b306-485a-83fe-807442e5358b 200 5.609 ms - 835 {“status”:0,“value”:{“platform”:“LINUX”,“browserName”:“Android”,“platformVersion”:“6.0.1”,“webStorageEnabled”:false,“takesScreenshot”:true,“javascriptEnabled”:true,“databaseEnabled”:false,“networkConnectionEnabled”:true,“locationContextEnabled”:false,“warnings”:{},“desired”:{“app”:“C:\Users\ASHUTOSH\Downloads\selendroid-test-app-0.17.0.apk”,“appPackage”:“io.selendroid.testapp”,“appActivity”:“io.selendroid.testapp.HomeScreenActivity”,“platformVersion”:“6.0.1”,“automationName”:“Appium”,“platformName”:“Android”,“deviceName”:“57da3ec0”},“app”:“C:\Users\ASHUTOSH\Downloads\selendroid-test-app-0.17.0.apk”,“appPackage”:“io.selendroid.testapp”,“appActivity”:“io.selendroid.testapp.HomeScreenActivity”,“automationName”:“Appium”,“platformName”:“Android”,“deviceName”:“57da3ec0”},“sessionId”:“0bbe504d-b306-485a-83fe-807442e5358b”}
info: → GET /wd/hub/session/0bbe504d-b306-485a-83fe-807442e5358b {}
info: [debug] Responding to client with success: {“status”:0,“value”:{“platform”:“LINUX”,“browserName”:“Android”,“platformVersion”:“6.0.1”,“webStorageEnabled”:false,“takesScreenshot”:true,“javascriptEnabled”:true,“databaseEnabled”:false,“networkConnectionEnabled”:true,“locationContextEnabled”:false,“warnings”:{},“desired”:{“app”:“C:\Users\ASHUTOSH\Downloads\selendroid-test-app-0.17.0.apk”,“appPackage”:“io.selendroid.testapp”,“appActivity”:“io.selendroid.testapp.HomeScreenActivity”,“platformVersion”:“6.0.1”,“automationName”:“Appium”,“platformName”:“Android”,“deviceName”:“57da3ec0”},“app”:“C:\Users\ASHUTOSH\Downloads\selendroid-test-app-0.17.0.apk”,“appPackage”:“io.selendroid.testapp”,“appActivity”:“io.selendroid.testapp.HomeScreenActivity”,“automationName”:“Appium”,“platformName”:“Android”,“deviceName”:“57da3ec0”},“sessionId”:“0bbe504d-b306-485a-83fe-807442e5358b”}
info: ← GET /wd/hub/session/0bbe504d-b306-485a-83fe-807442e5358b 200 1.523 ms - 835 {“status”:0,“value”:{“platform”:“LINUX”,“browserName”:“Android”,“platformVersion”:“6.0.1”,“webStorageEnabled”:false,“takesScreenshot”:true,“javascriptEnabled”:true,“databaseEnabled”:false,“networkConnectionEnabled”:true,“locationContextEnabled”:false,“warnings”:{},“desired”:{“app”:“C:\Users\ASHUTOSH\Downloads\selendroid-test-app-0.17.0.apk”,“appPackage”:“io.selendroid.testapp”,“appActivity”:“io.selendroid.testapp.HomeScreenActivity”,“platformVersion”:“6.0.1”,“automationName”:“Appium”,“platformName”:“Android”,“deviceName”:“57da3ec0”},“app”:“C:\Users\ASHUTOSH\Downloads\selendroid-test-app-0.17.0.apk”,“appPackage”:“io.selendroid.testapp”,“appActivity”:“io.selendroid.testapp.HomeScreenActivity”,“automationName”:“Appium”,“platformName”:“Android”,“deviceName”:“57da3ec0”},“sessionId”:“0bbe504d-b306-485a-83fe-807442e5358b”}
info: → GET /wd/hub/session/0bbe504d-b306-485a-83fe-807442e5358b {}
info: [debug] Responding to client with success: {“status”:0,“value”:{“platform”:“LINUX”,“browserName”:“Android”,“platformVersion”:“6.0.1”,“webStorageEnabled”:false,“takesScreenshot”:true,“javascriptEnabled”:true,“databaseEnabled”:false,“networkConnectionEnabled”:true,“locationContextEnabled”:false,“warnings”:{},“desired”:{“app”:“C:\Users\ASHUTOSH\Downloads\selendroid-test-app-0.17.0.apk”,“appPackage”:“io.selendroid.testapp”,“appActivity”:“io.selendroid.testapp.HomeScreenActivity”,“platformVersion”:“6.0.1”,“automationName”:“Appium”,“platformName”:“Android”,“deviceName”:“57da3ec0”},“app”:“C:\Users\ASHUTOSH\Downloads\selendroid-test-app-0.17.0.apk”,“appPackage”:“io.selendroid.testapp”,“appActivity”:“io.selendroid.testapp.HomeScreenActivity”,“automationName”:“Appium”,“platformName”:“Android”,“deviceName”:“57da3ec0”},“sessionId”:“0bbe504d-b306-485a-83fe-807442e5358b”}
info: ← GET /wd/hub/session/0bbe504d-b306-485a-83fe-807442e5358b 200 0.990 ms - 835 {“status”:0,“value”:{“platform”:“LINUX”,“browserName”:“Android”,“platformVersion”:“6.0.1”,“webStorageEnabled”:false,“takesScreenshot”:true,“javascriptEnabled”:true,“databaseEnabled”:false,“networkConnectionEnabled”:true,“locationContextEnabled”:false,“warnings”:{},“desired”:{“app”:“C:\Users\ASHUTOSH\Downloads\selendroid-test-app-0.17.0.apk”,“appPackage”:“io.selendroid.testapp”,“appActivity”:“io.selendroid.testapp.HomeScreenActivity”,“platformVersion”:“6.0.1”,“automationName”:“Appium”,“platformName”:“Android”,“deviceName”:“57da3ec0”},“app”:“C:\Users\ASHUTOSH\Downloads\selendroid-test-app-0.17.0.apk”,“appPackage”:“io.selendroid.testapp”,“appActivity”:“io.selendroid.testapp.HomeScreenActivity”,“automationName”:“Appium”,“platformName”:“Android”,“deviceName”:“57da3ec0”},“sessionId”:“0bbe504d-b306-485a-83fe-807442e5358b”}
info: → POST /wd/hub/session/0bbe504d-b306-485a-83fe-807442e5358b/timeouts {“type”:“implicit”,“ms”:30000}
info: [debug] Set Android implicit wait to 30000ms
info: [debug] Responding to client with success: {“status”:0,“value”:null,“sessionId”:“0bbe504d-b306-485a-83fe-807442e5358b”}
info: ← POST /wd/hub/session/0bbe504d-b306-485a-83fe-807442e5358b/timeouts 200 3.467 ms - 76 {“status”:0,“value”:null,“sessionId”:“0bbe504d-b306-485a-83fe-807442e5358b”}
info: → POST /wd/hub/session/0bbe504d-b306-485a-83fe-807442e5358b/element {“using”:“xpath”,“value”:“//android.widget.Button[@index=‘1’]”}
info: [debug] Waiting up to 30000ms for condition
info: [debug] Pushing command to appium work queue: [“find”,{“strategy”:“xpath”,“selector”:“//android.widget.Button[@index=‘1’]”,“context”:“”,“multiple”:false}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“action”,“action”:“find”,“params”:{“strategy”:“xpath”,“selector”:“//android.widget.Button[@index=‘1’]”,“context”:“”,“multiple”:false}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: find
info: [debug] [BOOTSTRAP] [debug] Finding //android.widget.Button[@index=‘1’] using XPATH with the contextId: multiple: false
info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[CLASS=android.widget.Button, INSTANCE=0]
info: [debug] [BOOTSTRAP] [debug] Returning result: {“status”:0,“value”:{“ELEMENT”:“1”}}
info: [debug] Responding to client with success: {“status”:0,“value”:{“ELEMENT”:“1”},“sessionId”:“0bbe504d-b306-485a-83fe-807442e5358b”}
info: ← POST /wd/hub/session/0bbe504d-b306-485a-83fe-807442e5358b/element 200 710.720 ms - 87 {“status”:0,“value”:{“ELEMENT”:“1”},“sessionId”:“0bbe504d-b306-485a-83fe-807442e5358b”}
info: → POST /wd/hub/session/0bbe504d-b306-485a-83fe-807442e5358b/element/1/click {“id”:“1”}
info: [debug] Pushing command to appium work queue: [“element:click”,{“elementId”:“1”}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“action”,“action”:“element:click”,“params”:{“elementId”:“1”}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: click
info: [debug] [BOOTSTRAP] [debug] Returning result: {“status”:0,“value”:true}
info: [debug] Responding to client with success: {“status”:0,“value”:true,“sessionId”:“0bbe504d-b306-485a-83fe-807442e5358b”}
info: ← POST /wd/hub/session/0bbe504d-b306-485a-83fe-807442e5358b/element/1/click 200 31.771 ms - 76 {“status”:0,“value”:true,“sessionId”:“0bbe504d-b306-485a-83fe-807442e5358b”}
info: [debug] Didn’t get a new command in 60 secs, shutting down…
info: Shutting down appium session
info: [debug] Pressing the HOME button
info: [debug] executing cmd: “C:\Program Files (x86)\Android\android-sdk\tools\adb.exe” -s 57da3ec0 shell “input keyevent 3”
info: [debug] Stopping logcat capture
info: [debug] Logcat terminated with code null, signal SIGTERM
info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“shutdown”}
info: [debug] [BOOTSTRAP] [debug] Got command of type SHUTDOWN
info: [debug] [BOOTSTRAP] [debug] Returning result: {“status”:0,“value”:“OK, shutting down”}
info: [debug] Sent shutdown command, waiting for UiAutomator to stop…
info: [debug] [BOOTSTRAP] [debug] Closed client connection
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=.
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: 0
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=
info: [debug] [UIAUTOMATOR STDOUT] Test results for WatcherResultPrinter=.
info: [debug] [UIAUTOMATOR STDOUT] Time: 64.636
info: [debug] [UIAUTOMATOR STDOUT] OK (1 test)
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: -1
info: [debug] UiAutomator shut down normally
info: [debug] Cleaning up android objects
info: [debug] Cleaning up appium session
info: [debug] We shut down because no new commands came in

I have change my device name using adb list - my device version is 6.0.1 and name is 57da3ec0.

Actually Application is launching but no click event is happening while it is clicking in emulator . In real device it is working

Maybe post the Appium server log for the failed click for the emulator. It looks like you are using Appium 1.4.13. That version is about 1.5 years old. If you are just starting your automation project, I would suggest downloading Appium Desktop which should be more stable, especially on more recent versions of Android.

Hi Doug,

Thanks for ur reply i have installed new version but still its not working. If you get time, can u pls try this for me, I am sharing apk location - http://selendroid.io/setup.html, pls download and try if possible.

HI- I’m sorry, I don’t have time to try the above apk, but I’m happy to help troubleshoot the current problem you are having. Are you in the same state? The script works fine on your tethered device but the script does not perform the click on the emulator? Whatever the current problem, please post the Appium server log messages and your current code.

Hi Doug,

My script is working with emulator but its not working with device, i am giving logs and code as below, pls troubleshoot the same -

public class LaunchApp extends UiAutomatorTestCase {

public static void main(String[] args) throws MalformedURLException, InterruptedException {
	
	DesiredCapabilities capabilites  = new DesiredCapabilities();
	
	capabilites.setCapability(CapabilityType.BROWSER_NAME, "");
	capabilites.setCapability("automationName", "Appium");
	capabilites.setCapability("platformName", "Android");
	capabilites.setCapability("platformVersion", "6.0.1");
	capabilites.setCapability("deviceName", "57da3ec0");  //57da3ec0
	capabilites.setCapability("app", "C:\\Users\\ASHUTOSH\\Downloads\\selendroid-test-app-0.17.0.apk");
	capabilites.setCapability("appPackage", "io.selendroid.testapp");
	capabilites.setCapability("appActivity", "io.selendroid.testapp.HomeScreenActivity");
	
	@SuppressWarnings("rawtypes")
	AndroidDriver driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilites);
	Thread.sleep(3000);
    
	driver.findElement(By.xpath("//android.widget.Button[@index='1']")).click();
   System.out.println("App launched successfully");
}

}


appium server log -

[HTTP] <-- GET /wd/hub/session/30414094-5053-4f27-9c27-4dbf0d34e33e 200 5 ms - 959
[HTTP] --> GET /wd/hub/session/30414094-5053-4f27-9c27-4dbf0d34e33e {}
[MJSONWP] Calling AppiumDriver.getSession() with args: [“30414094-5053-4f27-9c27-4dbf0d34e33e”]
[MJSONWP] Responding to client with driver.getSession() result: {“platform”:“LINUX”,“webStorageEnabled”:false,“takesScreenshot”:true,“javascriptEnabled”:true,“databaseEnabled”:false,“networkConnectionEnabled”:true,“locationContextEnabled”:false,“warnings”:{},“desired”:{“app”:“C:\Users\ASHUTOSH\Downloads\selendroid-test-app-0.17.0.apk”,“appPackage”:“io.selendroid.testapp”,“appActivity”:“io.selendroid.testapp.HomeScreenActivity”,“platformVersion”:“6.0.1”,“automationName”:“Appium”,“browserName”:"",“platformName”:“Android”,“deviceName”:“57da3ec0”},“app”:“C:\Users\ASHUTOSH\Downloads\selendroid-test-app-0.17.0.apk”,“appPackage”:“io.selendroid.testapp”,“appActivity”:“io.selendroid.testapp.HomeScreenActivity”,“platformVersion”:“6.0.1”,“automationName”:“Appium”,“browserName”:"",“platformName”:“Android”,“deviceName”:“57da3ec0”,“deviceUDID”:“57da3ec0”,“deviceScreenSize”:“1080x1920”,“deviceModel”:“Redmi Note 3”,“deviceManufacturer”:“Xiaomi”}
[HTTP] <-- GET /wd/hub/session/30414094-5053-4f27-9c27-4dbf0d34e33e 200 2 ms - 959
[HTTP] --> POST /wd/hub/session/30414094-5053-4f27-9c27-4dbf0d34e33e/element {“using”:“xpath”,“value”:"//android.widget.Button[@index=‘1’]"}
[MJSONWP] Calling AppiumDriver.findElement() with args: [“xpath”,"//android.widget.Button[@index=‘1’]",“30414094-5053-4f27-9c27-4dbf0d34e33e”]
[BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
[BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
[BaseDriver] Waiting up to 0 ms for condition
[AndroidBootstrap] Sending command to android: {“cmd”:“action”,“action”:“find”,“params”:{“strategy”:“xpath”,“selector”:"//android.widget.Button[@index=‘1’]",“context”:"",“multiple”:false}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {“cmd”:“action”,“action”:“find”,“params”:{“strategy”:“xpath”,“selector”:"//android.widget.Button[@index=‘1’]",“context”:"",“multiple”:false}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: find
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Finding ‘//android.widget.Button[@index=‘1’]’ using ‘XPATH’ with the contextId: ‘’ multiple: false
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using: UiSelector[CLASS=android.widget.Button, INSTANCE=0]
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {“status”:0,“value”:{“ELEMENT”:“1”}}
[AndroidBootstrap] Received command result from bootstrap
[MJSONWP] Responding to client with driver.findElement() result: {“ELEMENT”:“1”}
[HTTP] <-- POST /wd/hub/session/30414094-5053-4f27-9c27-4dbf0d34e33e/element 200 768 ms - 87
[HTTP] --> POST /wd/hub/session/30414094-5053-4f27-9c27-4dbf0d34e33e/element/1/click {“id”:“1”}
[MJSONWP] Calling AppiumDriver.click() with args: [“1”,“30414094-5053-4f27-9c27-4dbf0d34e33e”]
[AndroidBootstrap] Sending command to android: {“cmd”:“action”,“action”:“element:click”,“params”:{“elementId”:“1”}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {“cmd”:“action”,“action”:“element:click”,“params”:{“elementId”:“1”}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: click
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {“status”:0,“value”:true}


One more thing, does latest appium and android sdk support android version - 6.0.1 MMB29M

Hi Doug, script is working now with version - 4.4.2, it looks like version related issue.
Thanks for ur time. Need to ask one thing where can i track version related things like we have in selenium.

Glad that you got it going. Yes, versioning of the Appium server and Java client can be frustrating. Sometimes an upgrade breaks or deprecates something useful. You can find the release notes for the different versions of Appium Server and Java client at these links:


Thanks a lot Doug…

Need to change both USB Debugging and USB debugging(Security settings) mode ON under Developer options. It worked for me after wasting hours, hope this helps.