WebDriverException: Message: A new session could not be created. (Original error: Activity used to start app doesn't exist or cannot be launched! Make sure it exists and is a launchable activity)

Hi,

I am getting error as “A new session could not be created. (Original error: Activity used to start app doesn’t exist or cannot be launched! Make sure it exists and is a launchable activity)”

Can anyone let me know what might go wrong here

I am using Appium 1.4.16.1 on Windows 7

Logs are`> Checking if an update is available

Update not available
Launching Appium server with command: C:\Appium\node.exe lib\server\main.js --address 127.0.0.1 --port 4723 --session-override --platform-name Android --platform-version 19 --automation-name Appium --log-no-color
info: Welcome to Appium v1.4.16 (REV ae6877eff263066b26328d457bd285c0cc62430d)
info: Appium REST http interface listener started on 127.0.0.1:4723
info: [debug] Non-default server args: {“address”:“127.0.0.1”,“sessionOverride”:true,“logNoColors”:true,“platformName”:“Android”,“platformVersion”:“19”,“automationName”:“Appium”}
info: Console LogLevel: debug
info: → POST /wd/hub/session {“requiredCapabilities”:{},“desiredCapabilities”:{“deviceName”:“Gaurav”,“app”:“WeMo-STAGING-305-4b948aa.apk”,“platformVersion”:“4.4.2”,“appPackage”:“com.belkin.wemoandroid”,“platformName”:“Android”,“appActivity”:“com.belkin.activity.MainActivity”}}
info: Client User-Agent string: Python-urllib/2.7
info: [debug] App is an Android package, will attempt to run on device
info: [debug] Creating new appium session fb12b774-6109-4896-a415-e72e42535196
info: Starting android appium
info: [debug] Getting Java version
info: Java version is: 1.8.0_25
info: [debug] Checking whether adb is present
info: [debug] Using adb from C:\sdk\platform-tools\adb.exe
warn: No app capability, can’t parse package/activity
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: Retrieving device
info: [debug] Trying to find a connected android device
info: [debug] Getting connected devices…
info: [debug] executing cmd: C:\sdk\platform-tools\adb.exe devices
info: [debug] 1 device(s) connected
info: Found device 4d001f6ab48f90e9
info: [debug] Setting device id to 4d001f6ab48f90e9
info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)
info: [debug] executing cmd: C:\sdk\platform-tools\adb.exe -s 4d001f6ab48f90e9 wait-for-device
info: [debug] executing cmd: C:\sdk\platform-tools\adb.exe -s 4d001f6ab48f90e9 shell “echo ‘ready’”
info: [debug] Starting logcat capture
info: [debug] Getting device API level
info: [debug] executing cmd: C:\sdk\platform-tools\adb.exe -s 4d001f6ab48f90e9 shell “getprop ro.build.version.sdk”
info: [debug] Device is at API Level 19
info: Device API level is: 19
info: [debug] Extracting strings for language: default
info: [debug] Apk doesn’t exist locally
info: [debug] Could not get strings, but it looks like we had an old strings file anyway, so ignoring
info: [debug] executing cmd: C:\sdk\platform-tools\adb.exe -s 4d001f6ab48f90e9 shell “rm -rf /data/local/tmp/strings.json”
info: [debug] Not uninstalling app since server not started with --full-reset
info: [debug] Skipping install since we launched with a package instead of an app path
info: [debug] Forwarding system:4724 to device:4724
info: [debug] executing cmd: C:\sdk\platform-tools\adb.exe -s 4d001f6ab48f90e9 forward tcp:4724 tcp:4724
info: [debug] Pushing appium bootstrap to device…
info: [debug] executing cmd: C:\sdk\platform-tools\adb.exe -s 4d001f6ab48f90e9 push “C:\Appium\node_modules\appium\build\android_bootstrap\AppiumBootstrap.jar” /data/local/tmp/
info: [debug] Pushing settings apk to device…
info: [debug] executing cmd: C:\sdk\platform-tools\adb.exe -s 4d001f6ab48f90e9 install “C:\Appium\node_modules\appium\build\settings_apk\settings_apk-debug.apk”
info: [debug] Pushing unlock helper app to device…
info: [debug] executing cmd: C:\sdk\platform-tools\adb.exe -s 4d001f6ab48f90e9 install “C:\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:\sdk\platform-tools\adb.exe -s 4d001f6ab48f90e9 shell “ps ‘uiautomator’”
info: [debug] No matching processes found
info: [debug] Running bootstrap
info: [debug] spawning: C:\sdk\platform-tools\adb.exe -s 4d001f6ab48f90e9 shell uiautomator runtest AppiumBootstrap.jar -c io.appium.android.bootstrap.Bootstrap -e pkg WeMo-STAGING-305-4b948aa.apk -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] [BOOTSTRAP] [debug] Registered crash watchers.
info: [debug] Waking up device if it’s not alive
info: [debug] Pushing command to appium work queue: [“wake”,{}]
info: [debug] [BOOTSTRAP] [debug] Client connected
info: [debug] executing cmd: C:\sdk\platform-tools\adb.exe -s 4d001f6ab48f90e9 shell “dumpsys window”
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: {“value”:true,“status”:0}
info: Unlocking screen
info: [debug] Screen is locked, trying to unlock
info: [debug] Getting device API level
info: [debug] executing cmd: C:\sdk\platform-tools\adb.exe -s 4d001f6ab48f90e9 shell “getprop ro.build.version.sdk”
info: [debug] Device is at API Level 19
info: [debug] executing cmd: C:\sdk\platform-tools\adb.exe -s 4d001f6ab48f90e9 shell “am start -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000 -n io.appium.unlock/.Unlock”
info: [debug] executing cmd: C:\sdk\platform-tools\adb.exe -s 4d001f6ab48f90e9 shell “dumpsys window”
info: [debug] Screen is locked, trying to unlock
info: [debug] Getting device API level
info: [debug] executing cmd: C:\sdk\platform-tools\adb.exe -s 4d001f6ab48f90e9 shell “getprop ro.build.version.sdk”
info: [debug] Device is at API Level 19
info: [debug] executing cmd: C:\sdk\platform-tools\adb.exe -s 4d001f6ab48f90e9 shell “am start -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000 -n io.appium.unlock/.Unlock”
info: [debug] executing cmd: C:\sdk\platform-tools\adb.exe -s 4d001f6ab48f90e9 shell “dumpsys window”
info: [debug] Screen is 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: {“value”:“/data/local/tmp”,“status”:0}
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: {“value”:false,“status”:0}
info: [debug] Getting device API level
info: [debug] executing cmd: C:\sdk\platform-tools\adb.exe -s 4d001f6ab48f90e9 shell “getprop ro.build.version.sdk”
info: [debug] Device is at API Level 19
info: [debug] executing cmd: C:\sdk\platform-tools\adb.exe -s 4d001f6ab48f90e9 shell “am start -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000 -n WeMo-STAGING-305-4b948aa.apk/com.belkin.activity.MainActivity”
info: [debug] We tried to start an activity that doesn’t exist, retrying with . prepended to activity
info: [debug] Getting device API level
info: [debug] executing cmd: C:\sdk\platform-tools\adb.exe -s 4d001f6ab48f90e9 shell “getprop ro.build.version.sdk”
info: [debug] Device is at API Level 19
info: [debug] executing cmd: C:\sdk\platform-tools\adb.exe -s 4d001f6ab48f90e9 shell “am start -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000 -n WeMo-STAGING-305-4b948aa.apk/.com.belkin.activity.MainActivity”
error: Activity used to start app doesn’t exist or cannot be launched! Make sure it exists and is a launchable activity
info: [debug] Stopping logcat capture
info: [debug] Logcat terminated with code null, signal SIGTERM
info: [debug] Sent shutdown command, waiting for UiAutomator to stop…
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: {“value”:“OK, shutting down”,“status”:0}
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: 7.524
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
error: Failed to start an Appium session, err was: Error: Activity used to start app doesn’t exist or cannot be launched! Make sure it exists and is a launchable activity
info: [debug] Cleaning up appium session
info: [debug] Error: Activity used to start app doesn’t exist or cannot be launched! Make sure it exists and is a launchable activity
at [object Object]. (C:\Appium\node_modules\appium\node_modules\appium-adb\lib\adb.js:1146:21)
at [object Object]. (C:\Appium\node_modules\appium\node_modules\appium-adb\lib\adb.js:180:9)
at ChildProcess.exithandler (child_process.js:742:7)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1016:16)
at Process.ChildProcess._handle.onexit (child_process.js:1088:5)
info: [debug] Responding to client with error: {“status”:33,“value”:{“message”:“A new session could not be created. (Original error: Activity used to start app doesn’t exist or cannot be launched! Make sure it exists and is a launchable activity)”,“origValue”:“Activity used to start app doesn’t exist or cannot be launched! Make sure it exists and is a launchable activity”},“sessionId”:null}
info: ← POST /wd/hub/session 500 13469.826 ms - 346
`
My Python code is:

desired_caps = {} desired_caps['platformName'] = 'Android' desired_caps['platformVersion'] = '4.4.2' desired_caps['deviceName'] = 'Gaurav' desired_caps['app'] ='WeMo-STAGING-305-4b948aa.apk' desired_caps['appPackage'] = 'com.belkin.wemoandroid' desired_caps['appActivity'] = 'com.belkin.activity.MainActivity' self.driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', desired_caps) self.wd.implicitly_wait(60)

App settings screenshot
screen

Please help as I am unable to launch the from code but if I am using appium inspector it is launching the app, here are logs of appium inspector launching the app:
`> Launching Appium server with command: C:\Appium\node.exe lib\server\main.js --address 127.0.0.1 --port 4723 --app C:\Users\Gaurav.Kumar-admin\PycharmProjects\NewTest\Learning\AppRating\WeMo-STAGING-305-4b948aa.apk --app-activity com.belkin.activity.MainActivity --app-pkg com.belkin.wemoandroid --session-override --platform-name Android --platform-version 19 --automation-name Appium --device-name “Gaurav” --log-no-color

info: Welcome to Appium v1.4.16 (REV ae6877eff263066b26328d457bd285c0cc62430d)
info: Appium REST http interface listener started on 127.0.0.1:4723
info: [debug] Non-default server args: {“app”:“C:\Users\Gaurav.Kumar-admin\PycharmProjects\NewTest\Learning\AppRating\WeMo-STAGING-305-4b948aa.apk”,“address”:“127.0.0.1”,“sessionOverride”:true,“logNoColors”:true,“androidPackage”:“com.belkin.wemoandroid”,“androidActivity”:“com.belkin.activity.MainActivity”,“deviceName”:“Gaurav”,“platformName”:“Android”,“platformVersion”:“19”,“automationName”:“Appium”}
info: Console LogLevel: debug
info: → POST /wd/hub/session {“desiredCapabilities”:{“deviceName”:“Gaurav”,“app”:“C:\Users\Gaurav.Kumar-admin\PycharmProjects\NewTest\Learning\AppRating\WeMo-STAGING-305-4b948aa.apk”,“appActivity”:“com.belkin.activity.MainActivity”,“appPackage”:“com.belkin.wemoandroid”,“platformName”:“Android”}}
info: Client User-Agent string: undefined
info: [debug] Using local app from desired caps: C:\Users\Gaurav.Kumar-admin\PycharmProjects\NewTest\Learning\AppRating\WeMo-STAGING-305-4b948aa.apk
info: [debug] Creating new appium session 022bc5e8-e48b-4264-b892-d317a71ab7b8
info: Starting android appium
info: [debug] Getting Java version
info: Java version is: 1.8.0_25
info: [debug] Checking whether adb is present
info: [debug] Using adb from C:\sdk\platform-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:\sdk\platform-tools\adb.exe devices
info: [debug] 1 device(s) connected
info: Found device 4d001f6ab48f90e9
info: [debug] Setting device id to 4d001f6ab48f90e9
info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)
info: [debug] executing cmd: C:\sdk\platform-tools\adb.exe -s 4d001f6ab48f90e9 wait-for-device
info: [debug] executing cmd: C:\sdk\platform-tools\adb.exe -s 4d001f6ab48f90e9 shell “echo ‘ready’”
info: [debug] Starting logcat capture
info: [debug] Getting device API level
info: [debug] executing cmd: C:\sdk\platform-tools\adb.exe -s 4d001f6ab48f90e9 shell “getprop ro.build.version.sdk”
info: [debug] Device is at API Level 19
info: Device API level is: 19
info: [debug] Extracting strings for language: default
info: [debug] executing cmd: C:\sdk\platform-tools\adb.exe -s 4d001f6ab48f90e9 shell “getprop persist.sys.language”
info: [debug] Current device persist.sys.language: en
info: [debug] java -jar “C:\Appium\node_modules\appium\node_modules\appium-adb\jars\appium_apk_tools.jar” “stringsFromApk” “C:\Users\Gaurav.Kumar-admin\PycharmProjects\NewTest\Learning\AppRating\WeMo-STAGING-305-4b948aa.apk” “C:\Users\GAURAV~2.KUM\AppData\Local\Temp\com.belkin.wemoandroid” en
info: [debug] No strings.xml for language ‘en’, getting default strings.xml
info: [debug] java -jar “C:\Appium\node_modules\appium\node_modules\appium-adb\jars\appium_apk_tools.jar” “stringsFromApk” “C:\Users\Gaurav.Kumar-admin\PycharmProjects\NewTest\Learning\AppRating\WeMo-STAGING-305-4b948aa.apk” “C:\Users\GAURAV~2.KUM\AppData\Local\Temp\com.belkin.wemoandroid”
info: [debug] Reading strings from converted strings.json
info: [debug] Setting language to default
info: [debug] executing cmd: C:\sdk\platform-tools\adb.exe -s 4d001f6ab48f90e9 push “C:\Users\GAURAV~2.KUM\AppData\Local\Temp\com.belkin.wemoandroid\strings.json” /data/local/tmp
info: [debug] Checking whether aapt is present
info: [debug] Using aapt from C:\sdk\build-tools\23.0.2\aapt.exe
info: [debug] Retrieving process from manifest.
info: [debug] executing cmd: C:\sdk\build-tools\23.0.2\aapt.exe dump xmltree C:\Users\Gaurav.Kumar-admin\PycharmProjects\NewTest\Learning\AppRating\WeMo-STAGING-305-4b948aa.apk AndroidManifest.xml
info: [debug] Set app process to: com.belkin.wemoandroid
info: [debug] Not uninstalling app since server not started with --full-reset
info: [debug] Checking app cert for C:\Users\Gaurav.Kumar-admin\PycharmProjects\NewTest\Learning\AppRating\WeMo-STAGING-305-4b948aa.apk.
info: [debug] executing cmd: java -jar C:\Appium\node_modules\appium\node_modules\appium-adb\jars\verify.jar C:\Users\Gaurav.Kumar-admin\PycharmProjects\NewTest\Learning\AppRating\WeMo-STAGING-305-4b948aa.apk
info: [debug] App not signed with debug cert.
info: [debug] Resigning apk.
info: [debug] executing cmd: java -jar C:\Appium\node_modules\appium\node_modules\appium-adb\jars\sign.jar C:\Users\Gaurav.Kumar-admin\PycharmProjects\NewTest\Learning\AppRating\WeMo-STAGING-305-4b948aa.apk --override
info: [debug] Zip-aligning C:\Users\Gaurav.Kumar-admin\PycharmProjects\NewTest\Learning\AppRating\WeMo-STAGING-305-4b948aa.apk
info: [debug] Checking whether zipalign is present
info: [debug] Using zipalign from C:\sdk\build-tools\23.0.2\zipalign.exe
info: [debug] Zip-aligning apk.
info: [debug] executing cmd: C:\sdk\build-tools\23.0.2\zipalign.exe -f 4 C:\Users\Gaurav.Kumar-admin\PycharmProjects\NewTest\Learning\AppRating\WeMo-STAGING-305-4b948aa.apk C:\Users\GAURAV~2.KUM\AppData\Local\Temp\11671-14748-11tq3vf\appium.tmp
info: [debug] MD5 for app is 92ab64a8a1ba34a36235924641dcb204
info: [debug] executing cmd: C:\sdk\platform-tools\adb.exe -s 4d001f6ab48f90e9 shell “ls /data/local/tmp/92ab64a8a1ba34a36235924641dcb204.apk”
info: [debug] Getting install status for com.belkin.wemoandroid
info: [debug] Getting device API level
info: [debug] executing cmd: C:\sdk\platform-tools\adb.exe -s 4d001f6ab48f90e9 shell “getprop ro.build.version.sdk”
info: [debug] Device is at API Level 19
info: [debug] executing cmd: C:\sdk\platform-tools\adb.exe -s 4d001f6ab48f90e9 shell “pm list packages -3 com.belkin.wemoandroid”
info: [debug] App is installed
info: Installing App
info: [debug] executing cmd: C:\sdk\platform-tools\adb.exe -s 4d001f6ab48f90e9 shell “mkdir -p /data/local/tmp/”
info: [debug] Removing any old apks
info: [debug] executing cmd: C:\sdk\platform-tools\adb.exe -s 4d001f6ab48f90e9 shell “ls /data/local/tmp/*.apk”
info: [debug] executing cmd: C:\sdk\platform-tools\adb.exe -s 4d001f6ab48f90e9 shell rm “/data/local/tmp/5bb0cdf4fd63040272e3b53771714372.apk”
info: [debug] executing cmd: C:\sdk\platform-tools\adb.exe -s 4d001f6ab48f90e9 push “C:\Users\Gaurav.Kumar-admin\PycharmProjects\NewTest\Learning\AppRating\WeMo-STAGING-305-4b948aa.apk” /data/local/tmp/92ab64a8a1ba34a36235924641dcb204.apk
info: [debug] Uninstalling com.belkin.wemoandroid
info: [debug] executing cmd: C:\sdk\platform-tools\adb.exe -s 4d001f6ab48f90e9 shell “am force-stop com.belkin.wemoandroid”
info: ← POST /wd/hub/session - - ms - -
info: [debug] executing cmd: C:\sdk\platform-tools\adb.exe -s 4d001f6ab48f90e9 uninstall com.belkin.wemoandroid
info: [debug] App was uninstalled
info: [debug] executing cmd: C:\sdk\platform-tools\adb.exe -s 4d001f6ab48f90e9 shell “pm install -r /data/local/tmp/92ab64a8a1ba34a36235924641dcb204.apk”
undefined
info: [debug] Forwarding system:4724 to device:4724
info: [debug] executing cmd: C:\sdk\platform-tools\adb.exe -s 4d001f6ab48f90e9 forward tcp:4724 tcp:4724
info: [debug] Pushing appium bootstrap to device…
info: [debug] executing cmd: C:\sdk\platform-tools\adb.exe -s 4d001f6ab48f90e9 push “C:\Appium\node_modules\appium\build\android_bootstrap\AppiumBootstrap.jar” /data/local/tmp/
info: [debug] Pushing settings apk to device…
info: [debug] executing cmd: C:\sdk\platform-tools\adb.exe -s 4d001f6ab48f90e9 install “C:\Appium\node_modules\appium\build\settings_apk\settings_apk-debug.apk”
info: [debug] Pushing unlock helper app to device…
info: [debug] executing cmd: C:\sdk\platform-tools\adb.exe -s 4d001f6ab48f90e9 install “C:\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:\sdk\platform-tools\adb.exe -s 4d001f6ab48f90e9 shell “ps ‘uiautomator’”
info: [debug] No matching processes found
info: [debug] Running bootstrap
info: [debug] spawning: C:\sdk\platform-tools\adb.exe -s 4d001f6ab48f90e9 shell uiautomator runtest AppiumBootstrap.jar -c io.appium.android.bootstrap.Bootstrap -e pkg com.belkin.wemoandroid -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] [BOOTSTRAP] [debug] json loading complete.
info: [debug] [BOOTSTRAP] [debug] Registered crash watchers.
info: [debug] Waking up device if it’s not alive
info: [debug] Pushing command to appium work queue: [“wake”,{}]
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] executing cmd: C:\sdk\platform-tools\adb.exe -s 4d001f6ab48f90e9 shell “dumpsys window”
info: [debug] [BOOTSTRAP] [debug] Returning result: {“value”:true,“status”:0}
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: {“value”:“/data/local/tmp”,“status”:0}
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: {“value”:false,“status”:0}
info: [debug] Getting device API level
info: [debug] executing cmd: C:\sdk\platform-tools\adb.exe -s 4d001f6ab48f90e9 shell “getprop ro.build.version.sdk”
info: [debug] Device is at API Level 19
info: [debug] executing cmd: C:\sdk\platform-tools\adb.exe -s 4d001f6ab48f90e9 shell “am start -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000 -n com.belkin.wemoandroid/com.belkin.activity.MainActivity”
info: [debug] Waiting for pkg “com.belkin.wemoandroid” and activity “com.belkin.activity.MainActivity” to be focused
info: [debug] Getting focused package and activity
info: [debug] executing cmd: C:\sdk\platform-tools\adb.exe -s 4d001f6ab48f90e9 shell “dumpsys window windows”
info: [debug] executing cmd: C:\sdk\platform-tools\adb.exe -s 4d001f6ab48f90e9 shell “getprop ro.build.version.release”
info: [debug] Device is at release version 4.4.2
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 022bc5e8-e48b-4264-b892-d317a71ab7b8
`
I haved used this command to adb shell “dumpsys window windows | grep -E ‘mCurren
tFocus’” after launching the app and getting below output

C:\Users\Gaurav.Kumar-admin>adb shell “dumpsys window windows | grep -E ‘mCurren
tFocus’”
mCurrentFocus=Window{43aec938 u0 com.belkin.wemoandroid/com.belkin.activity.Ma
inActivity}