Inspector Connection Error, 'Failed to connect to the server. Please check that it is runninng.' error

I’m running appium 1.4.16.1 (windows) and getting the above error when running a test script which launches an android app, while clicking the ‘refresh’ button on Inspector. Below I’m including my example test script, and the appium server log error. What must be done to resolve this error?

(python) test script:

    desired_caps = {}
    desired_caps['platformName'] = 'Android'
    desired_caps['platformVersion'] = '6.0'
    desired_caps['deviceName'] = 'Android Emulator'
    desired_caps['app'] = 'C:\\test\\TimeWorksMobile.apk'

This is what shows in the appium server log when the ‘refresh’ button is clicked:

info: → POST /wd/hub/session {“desiredCapabilities”:{“app”:“C:\test\TimeWorksMobile.apk”,“platformName”:“Android”}}
info: Client User-Agent string: undefined
info: Found an existing session to clobber, shutting it down first…
info: Shutting down appium session
info: [debug] Pressing the HOME button
info: [debug] executing cmd: C:\Users\mwebster\AppData\Local\Android\sdk\platform-tools\adb.exe -s emulator-5554 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] [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: 27.378
info: [debug] [UIAUTOMATOR STDOUT] OK (1 test)
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: -1
info: [debug] Sent shutdown command, waiting for UiAutomator to stop…
info: [debug] UiAutomator shut down normally
info: [debug] Cleaning up android objects
info: [debug] Cleaning up appium session
info: Old session shut down OK, proceeding to new session
info: [debug] Got configuration error, not starting session
error: The following desired capabilities are required, but were not provided: deviceName
info: [debug] Cleaning up appium session
error: Failed to start an Appium session, err was: Error: The following desired capabilities are required, but were not provided: deviceName
info: [debug] Error: The following desired capabilities are required, but were not provided: deviceName
at [object Object].Capabilities.checkValidity (C:\Program Files (x86)\Appium\node_modules\appium\lib\server\capabilities.js:146:13)
at [object Object].Appium.configure (C:\Program Files (x86)\Appium\node_modules\appium\lib\appium.js:238:35)
at [object Object]. (C:\Program Files (x86)\Appium\node_modules\appium\lib\appium.js:118:10)
at C:\Program Files (x86)\Appium\node_modules\appium\lib\appium.js:136:7
at [object Object].Appium.cleanupSession (C:\Program Files (x86)\Appium\node_modules\appium\lib\appium.js:338:5)
at [object Object]. (C:\Program Files (x86)\Appium\node_modules\appium\lib\appium.js:376:10)
at [object Object]. (C:\Program Files (x86)\Appium\node_modules\appium\lib\devices\android\android.js:458:11)
at [object Object].UiAutomator.exitHandler (C:\Program Files (x86)\Appium\node_modules\appium\lib\devices\android\uiautomator.js:70:10)
at ChildProcess.emit (events.js:110:17)
at Process.ChildProcess._handle.onexit (child_process.js:1075:12)
info: [debug] Responding to client with error: {“status”:33,“value”:{“message”:“A new session could not be created. (Original error: The following desired capabilities are required, but were not provided: deviceName)”,“origValue”:“The following desired capabilities are required, but were not provided: deviceName”},“sessionId”:null}
info: ← POST /wd/hub/session 500 587.774 ms - 286