Capabilities get sent twice

One AndroidDriver creation yeilds the following Appium log. The capabilities are sent twice. Does anyone know why this might be?

ad = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);



Console LogLevel: debug
e[37m-->e[39m e[37mPOSTe[39m e[37m/wd/hub/sessione[39m e[90m{"desiredCapabilities":{...}}
Client User-Agent string: Apache-HttpClient/4.3.4 (java 1.5)
[debug] No appActivity desired capability or server param. Parsing from apk.
[debug] No appPackage desired capability or server param. Parsing from apk.
[debug] Using local app from desired caps: test.apk
[debug] Creating new appium session 92680fcf-890b-422f-a408-82358e5dae0e
Starting android appium
[debug] Getting Java version
Java version is: 1.8.0_45
[debug] Checking whether adb is present
[debug] Using adb from adb
[debug] Parsing package and activity from app manifest
[debug] Checking whether aapt is present
[debug] Using aapt from aapt
[debug] Extracting package and launch activity from manifest.
[debug] executing cmd: aapt dump badging test.apk
[debug] badging package: com.test.beta
[debug] badging act: com.test.beta
[debug] Parsed package and activity are: com.test.beta/com.test.beta
[debug] Using fast reset? true
[debug] Preparing device for session
[debug] Checking whether app is actually present
Retrieving device
[debug] Trying to find a connected android device
[debug] Getting connected devices...
[debug] executing cmd: adb devices
[debug] 4 device(s) connected
Found device d
[debug] Setting device id to d
[debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)
[debug] executing cmd: adb -s d wait-for-device
[debug] executing cmd: adb -s d shell "echo 'ready'"
[debug] Starting logcat capture
e[37m<-- POST /wd/hub/session e[39me[32m-e[39me[90m - ms - -e[39m e[90me[39m
e[37m-->e[39m e[37mPOSTe[39m e[37m/wd/hub/sessione[39m e[90m{"desiredCapabilities":{...}}e[39m
Client User-Agent string: Apache-HttpClient/4.3.4 (java 1.5)
Found an existing session to clobber, shutting it down first...
Shutting down appium session

EDIT: It appears that there is a 10minute delay between when the first session “ends” and the second starts. I’m denoting start/stop of the second when the capabilities are sent.

[37mPOSTe[39m e[37m/wd/hub/sessione[39m e[90m{"desiredCapabilities":{...}}

EDIT2: It appears to hang the most on

adb install "/Applications/Appium.app/Contents/Resources/node_modules/appium/build/unlock_apk/unlock_apk-debug.apk"