Appium Seems to Stop After "Stopping Logcat Capture" Message

I have been trying for several days to get Appium up and running. I feel that I am close but missing something.

I am using a Mac with OSX 10.9.4, Android Studio, ADB.

I am trying to get the Python > android_contacts.py script to run.

I have started my emulator and installed the ContactsManager.apk onto my emulator.

I open Terminal and do:

appium
python android_contacts.py

Then I get this output in Terminal:

info: [debug] Using local app from desired caps: /Users/Chris/Desktop/sample-code-master/sample-code/apps/ContactManager/ContactManager.apk
info: [debug] Creating new appium session e4258bd2-0dfa-440c-939b-f76472900e15
info: Starting android appium
info: [debug] Using fast reset? true
info: [debug] Preparing device for session
info: [debug] Checking whether app is actually present
info: [debug] Checking whether adb is present
info: [debug] Using adb from /Applications/Android Studio.app/sdk/platform-tools/adb
info: Retrieving device
info: [debug] Trying to find a connected android device
info: [debug] Getting connected devices…
info: [debug] executing: “/Applications/Android Studio.app/sdk/platform-tools/adb” devices
info: [debug] 1 device(s) connected
info: Found device emulator-5554
info: [debug] Setting device id to emulator-5554
info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)
info: [debug] executing: “/Applications/Android Studio.app/sdk/platform-tools/adb” -s emulator-5554 wait-for-device
info: [debug] executing: “/Applications/Android Studio.app/sdk/platform-tools/adb” -s emulator-5554 shell “echo ‘ready’”
info: [debug] Starting logcat capture
error: Logcat capture failed: spawn ENOENT
info: [debug] Stopping logcat capture

At this point, nothing else happens. I’ve let it sit for quite a long time, tried clicking in the emulator, nothing seems to forward the action.

Any input or tips would be very much appreciated.


Some More Info:
I found the Appium GUI tool and started the server from there. Then I ran

python android_contacts.py

in the Terminal.

After 10 minutes of messages like this in the GUI:

info: → GET /wd/hub/status {}
info: [debug] Responding to client with success: {“status”:0,“value”:{“build”:{“version”:“1.2.2”,“revision”:“cf6ff5939ddc6b4d45fcbabfbfe13c950e0058c4”}},“sessionId”:“73d3593c-65bc-45b0-a932-aaf24b3b63af”}
info: ← GET /wd/hub/status 200 0.637 ms - 155 {“status”:0,“value”:{“build”:{“version”:“1.2.2”,“revision”:“cf6ff5939ddc6b4d45fcbabfbfe13c950e0058c4”}},“sessionId”:“73d3593c-65bc-45b0-a932-aaf24b3b63af”}

It finally gave up, displaying this in the Terminal:

Traceback (most recent call last):
File “android_contacts.py”, line 23, in setUp
self.driver = webdriver.Remote(‘http://localhost:4723/wd/hub’, desired_caps)
File “/Library/Python/2.7/site-packages/appium/webdriver/webdriver.py”, line 35, in init
super(WebDriver, self).init(command_executor, desired_capabilities, browser_profile, proxy, keep_alive)
File “/Library/Python/2.7/site-packages/selenium/webdriver/remote/webdriver.py”, line 73, in init
self.start_session(desired_capabilities, browser_profile)
File “/Library/Python/2.7/site-packages/selenium/webdriver/remote/webdriver.py”, line 121, in start_session
‘desiredCapabilities’: desired_capabilities,
File “/Library/Python/2.7/site-packages/selenium/webdriver/remote/webdriver.py”, line 171, in execute
response = self.command_executor.execute(driver_command, params)
File “/Library/Python/2.7/site-packages/selenium/webdriver/remote/remote_connection.py”, line 349, in execute
return self._request(command_info[0], url, body=data)
File “/Library/Python/2.7/site-packages/selenium/webdriver/remote/remote_connection.py”, line 417, in _request
resp = opener.open(request)
File “/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py”, line 404, in open
response = self._open(req, data)
File “/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py”, line 422, in _open
‘_open’, req)
File “/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py”, line 382, in _call_chain
result = func(*args)
File “/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py”, line 1214, in http_open
return self.do_open(httplib.HTTPConnection, req)
File “/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py”, line 1187, in do_open
r = h.getresponse(buffering=True)
File “/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py”, line 1045, in getresponse
response.begin()
File “/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py”, line 409, in begin
version, status, reason = self._read_status()
File “/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py”, line 373, in _read_status
raise BadStatusLine(line)
BadStatusLine: ‘’

So… Seems like the Terminal / Python scripts can’t connect to http://localhost:4723/wd/hub ?

Do you have a space in Android SDK location? If yes try to remove it and see if it helps.

1 Like

Wow that was it. Thank you.

It’s funny, but it really works

I do not have space in my path. Please help me i am still getting the issue

nfo: Client User-Agent string: Apache-HttpClient/4.3.3 (java 1.5)
info: [debug] The following desired capabilities were provided, but not recognized by appium. They will be passed on to any other services running on this server. : device
info: [debug] Didn’t get app but did get Android package, will attempt to launch it on the device
info: [debug] Creating new appium session fed45985-73d9-49e5-896a-69f0026ba173
info: Starting android appium
info: [debug] Getting Java version
info: Java version is: 1.7.0_71
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: [debug] Checking whether adb is present
warn: The ANDROID_HOME environment variable is not set to the Android SDK root directory path. ANDROID_HOME is required for compatibility with SDK 23+. Checking along PATH for adb.
info: [debug] executing cmd: which adb
info: [debug] Using adb from /Applications/AndroidDevelopmentSDK/sdk/platform-tools/adb

info: Retrieving device
info: [debug] Trying to find a connected android device
info: [debug] Getting connected devices…
info: [debug] executing cmd: “/Applications/AndroidDevelopmentSDK/sdk/platform-tools/adb” devices
info: [debug] 1 device(s) connected
info: Found device 3004d217f3923100
info: [debug] Setting device id to 3004d217f3923100
info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)
info: [debug] executing cmd: “/Applications/AndroidDevelopmentSDK/sdk/platform-tools/adb” -s 3004d217f3923100 wait-for-device
info: [debug] executing cmd: “/Applications/AndroidDevelopmentSDK/sdk/platform-tools/adb” -s 3004d217f3923100 shell “echo ‘ready’”
info: [debug] Starting logcat capture
error: Logcat capture failed: spawn ENOENT
info: [debug] Stopping logcat capture

How to fix this?? I am using Mac Os 10.10.1 & Xcode 6.1 and
trying to launch the ios app through eclipse to perform some testing but
getting this error dont know how to reseolve this issue. I have updated
the appium to 1.3.4 but still same. Tried to launch same ios app with
appium 1.3.3 GUI this app launches properly. Anyone can suggest
anything.

Above issue is observed with simulator 7.1,8.1 etc
By any chance can this be happening bcoz of “No signing Identity found” in xcode

info: Welcome to Appium v1.3.4 (REV 056f5bd277987bed391aef04acf2be38ea161e50)
info: Appium REST http interface listener started on 0.0.0.0:4723
info: Console LogLevel: debug
info:
–> POST /wd/hub/session
{“desiredCapabilities”:{“app”:"/Users/Anand/Library/Developer/Xcode/DerivedData/Passport-dtutyhtjuncbbnhacstomnqkjttc/Build/Products/Debug-iphonesimulator/Passport.app",“appium-version”:“1.0”,“platformVersion”:“7.1”,“browserName”:"",“platformName”:“iOS”,“udid”:“13FF8920-587E-4AF6-A3B9-AA32E81624EC”,“deviceName”:“iPhone
5s”}}
info: Client User-Agent string: Apache-HttpClient/4.3.4 (java 1.5)
info:
[debug] The following desired capabilities were provided, but not
recognized by appium. They will be passed on to any other services
running on this server. : appium-version
info: [debug] Using local
app from desired caps:
/Users/Anand/Library/Developer/Xcode/DerivedData/Passport-dtutyhtjuncbbnhacstomnqkjttc/Build/Products/Debug-iphonesimulator/Passport.app
info: [debug] Creating new appium session 2eb74755-4582-46cf-97b9-78b548cfa1b9
info: [debug] Removing any remaining instruments sockets
info: [debug] Cleaned up instruments socket /tmp/instruments_sock
info: [debug] Setting Xcode folder
info: [debug] Setting Xcode version
info: [debug] Setting iOS SDK Version
info: [debug] Getting sdk version from xcrun with a timeout
info: [debug] iOS SDK Version set to 8.1
info: [debug] Not checking whether simulator is available since we’re on a real device
info: [debug] Detecting automation tracetemplate
info: [debug] Not auto-detecting udid, running on sim
info:
[debug] Could not parse plist file (as binary) at
/Users/Anand/Library/Developer/Xcode/DerivedData/Passport-dtutyhtjuncbbnhacstomnqkjttc/Build/Products/Debug-iphonesimulator/Passport.app/en.lproj/Localizable.strings
info: Will try to parse the plist file as XML
info:
[debug] Could not parse plist file (as XML) at
/Users/Anand/Library/Developer/Xcode/DerivedData/Passport-dtutyhtjuncbbnhacstomnqkjttc/Build/Products/Debug-iphonesimulator/Passport.app/en.lproj/Localizable.strings
warn: Could not parse app Localizable.strings assuming it doesn’t exist
info: [debug] Getting bundle ID from app
info: [debug] Parsed app Info.plist (as binary)
info: [debug] Creating instruments
info:
On some xcode 6 platforms, instruments-without-delay does not work. If
you experience this, you will need to re-run appium with the
–native-instruments-lib flag
info: [debug] Preparing uiauto bootstrap
info: [debug] Dynamic bootstrap dir: /Users/Anand/Library/Application Support/appium/bootstrap
info:
[debug] Dynamic env:
{“nodePath”:"/usr/local/bin/node",“commandProxyClientPath”:"/Users/Anand/appium/node_modules/appium-uiauto/bin/command-proxy-client.js",“instrumentsSock”:"/tmp/instruments_sock",“interKeyDelay”:null,“justLoopInfinitely”:false,“autoAcceptAlerts”:false,“sendKeyStrategy”:“grouped”}
…o: [debug] Dynamic bootstrap code: // This file is automatically generated. Do not manually modify!
info: [debug] Dynamic bootstrap path: /Users/Anand/Library/Application Support/appium/bootstrap/bootstrap-723f69bfa90dadc3.js
info: [debug] Reusing dynamic bootstrap: /Users/Anand/Library/Application Support/appium/bootstrap/bootstrap-723f69bfa90dadc3.js
info:
[debug] Getting device string from opts:
{“forceIphone”:false,“forceIpad”:false,“xcodeVersion”:“6.1.1”,“iOSSDKVersion”:“8.1”,“deviceName”:“iPhone
5s”,“platformVersion”:“7.1”}
info: [debug] fixDevice is on
info: [debug] Final device string is: ‘iPhone 5s (7.1 Simulator)’
info: [debug] Not setting device type since we’re on a real device
info: [debug] Checking whether we need to set app preferences
info: [debug] Not setting iOS and app preferences since we’re on a real device
info: [debug] Running ios sim reset flow
info: [debug] Killing the simulator process
info: [debug] Killall iOS Simulator
info: [debug] Killing any other simulator daemons
info: [debug] On a real device; cannot clean device state
info: [debug] Not setting locale because we’re using a real device
info: [debug] No iOS / app preferences to set
info: [debug] Starting iOS device log capture via deviceconsole
error: Log capture did not start in a reasonable amount of time
info: [debug] Cleaning up appium session
error: Failed to start an Appium session, err was: Error: Log capture did not start in a reasonable amount of time
info: [debug] Error: Log capture did not start in a reasonable amount of time
at null._onTimeout (/Users/Anand/appium/lib/devices/ios/ios-log.js:137:10)
at Timer.listOnTimeout as ontimeout
info:
[debug] Responding to client with error:
{“status”:33,“value”:{“message”:“A new session could not be created.
(Original error: Log capture did not start in a reasonable amount of
time)”,“origValue”:“Log capture did not start in a reasonable amount of
time”},“sessionId”:null}
info: <-- POST /wd/hub/session 500 11780.237 ms - 234
info: [debug] Not pre-launching simulator
info: [debug] Creating iDevice object with udid 13FF8920-587E-4AF6-A3B9-AA32E81624EC
info:
[debug] Couldn’t find ideviceinstaller, trying built-in at
/Users/Anand/appium/build/libimobiledevice-macosx/ideviceinstaller
info:
[debug] Checking app install status using:
/Users/Anand/appium/build/fruitstrap/fruitstrap isInstalled --id
13FF8920-587E-4AF6-A3B9-AA32E81624EC --bundle com.passportparking.mobile

Hi,
Ru killing an existing session and then starting a new one. It seems an existing appium process has not been killed and your test requests a new process using same port 4723.
Appium dev team has to raise an exception int his situation.

Hi,

Appium is freezing for me too, please help.

Logs -
info: [debug] [BOOTSTRAP] [debug] Returning result: {“status”:0,“value”:{“height”:1776,“width”:1080}}
info: --> POST /wd/hub/session/82773d60-9eb3-446c-bbdc-94fe80967995/touch/perform {“actions”:[{“action”:“press”,“options”:{“x”:540,“y”:1480}},{“action”:“wait”,“options”:{“ms”:0}},{“action”:“moveTo”,“options”:{“x”:540,“y”:710}},{“action”:“release”,“options”:{}}]}
info: [debug] Pushing command to appium work queue: [“swipe”,{“startX”:540,“startY”:1480,“endX”:540,“endY”:710,“steps”:22}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“action”,“action”:“swipe”,“params”:{“startX”:540,“startY”:1480,“endX”:540,“endY”:710,“steps”:22}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: swipe
info: [debug] [BOOTSTRAP] [debug] Display bounds: [0,0][1080,1776]
info: [debug] [BOOTSTRAP] [debug] Display bounds: [0,0][1080,1776]
info: [debug] [BOOTSTRAP] [debug] Swiping from [x=540.0, y=1480.0] to [x=540.0, y=710.0] with steps: 22
info: [debug] [BOOTSTRAP] [debug] Returning result: {“status”:0,“value”:true}
info: [debug] Responding to client with success: {“status”:0,“value”:true,“sessionId”:“82773d60-9eb3-446c-bbdc-94fe80967995”}
info: <-- POST /wd/hub/session/82773d60-9eb3-446c-bbdc-94fe80967995/touch/perform 200 2329.759 ms - 76 {“status”:0,“value”:true,“sessionId”:“82773d60-9eb3-446c-bbdc-94fe80967995”}
info: --> GET /wd/hub/session/82773d60-9eb3-446c-bbdc-94fe80967995/contexts {}
info: [debug] Getting a list of available webviews
info: [debug] executing cmd: /Users/neha.goyal/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell “cat /proc/net/unix”
info: [debug] WEBVIEW_17014 mapped to pid 17014
info: [debug] Getting process name for webview
info: [debug] executing cmd: /Users/neha.goyal/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell “ps”
info: [debug] Parsed pid: 17014 pkg: com.flipkart.android
info: [debug] from: u0_a57,17014,945,920216,200568,ffffffff,b7735b31,R,com.flipkart.android
info: [debug] returning process name: com.flipkart.android
info: [debug] Available contexts: NATIVE_APP,WEBVIEW_com.flipkart.android
info: [debug] [“WEBVIEW_com.flipkart.android”]
info: [debug] Available contexts: NATIVE_APP,WEBVIEW_com.flipkart.android
info: [debug] Responding to client with success: {“status”:0,“value”:[“NATIVE_APP”,“WEBVIEW_com.flipkart.android”],“sessionId”:“82773d60-9eb3-446c-bbdc-94fe80967995”}
info: <-- GET /wd/hub/session/82773d60-9eb3-446c-bbdc-94fe80967995/contexts 200 146.900 ms - 117 {“status”:0,“value”:[“NATIVE_APP”,“WEBVIEW_com.flipkart.android”],“sessionId”:“82773d60-9eb3-446c-bbdc-94fe80967995”}
info: --> GET /wd/hub/session/82773d60-9eb3-446c-bbdc-94fe80967995/context {}
info: [debug] Responding to client with success: {“status”:0,“value”:“NATIVE_APP”,“sessionId”:“82773d60-9eb3-446c-bbdc-94fe80967995”}
info: <-- GET /wd/hub/session/82773d60-9eb3-446c-bbdc-94fe80967995/context 200 0.874 ms - 84 {“status”:0,“value”:“NATIVE_APP”,“sessionId”:“82773d60-9eb3-446c-bbdc-94fe80967995”}
info: --> POST /wd/hub/session/82773d60-9eb3-446c-bbdc-94fe80967995/context {“name”:“WEBVIEW_com.flipkart.android”}
info: [debug] Getting a list of available webviews
info: [debug] executing cmd: /Users/neha.goyal/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell “cat /proc/net/unix”
info: [debug] WEBVIEW_17014 mapped to pid 17014
info: [debug] Getting process name for webview
info: [debug] executing cmd: /Users/neha.goyal/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell “ps”
info: [debug] Parsed pid: 17014 pkg: com.flipkart.android
info: [debug] from: u0_a57,17014,945,920216,200572,ffffffff,b77351b6,S,com.flipkart.android
info: [debug] returning process name: com.flipkart.android
info: [debug] Available contexts: NATIVE_APP,WEBVIEW_com.flipkart.android
info: [debug] [“WEBVIEW_com.flipkart.android”]
info: [debug] Available contexts: NATIVE_APP,WEBVIEW_com.flipkart.android
info: [debug] Connecting to chrome-backed webview
info: [debug] Found existing Chromedriver for context ‘WEBVIEW_com.flipkart.android’. Using it.
info: JSONWP Proxy: Proxying [GET /url] to [GET http://127.0.0.1:9515/wd/hub/session/a7b6100f79694f5d9d75bac4c6891647/url] with no body
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: /Users/neha.goyal/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell “input keyevent 3”
info: [debug] Stopping logcat capture
info: [debug] Logcat terminated with code null, signal SIGTERM
info: [debug] Stopping chromedriver for context WEBVIEW_com.flipkart.android
info: Chromedriver: Changed state to ‘stopping’
info: JSONWP Proxy: Proxying [DELETE /] to [DELETE http://127.0.0.1:9515/wd/hub/session/a7b6100f79694f5d9d75bac4c6891647] with no body