Issue launching Android Emulator

I have setup Android Studio, and an AVD that I can start manually and it works. I made sure all my environment variables (ANDROID_HOME, etc) have been set and the appium health checks are green. If I turn this emulator off and try to run my test with the appium server running I get the following error:

error: Unable to start Emulator: emulator: ERROR: This AVD’s configuration is missing a kernel file!!
emulator: ERROR: ANDROID_SDK_ROOT is undefined

If I turn the emulator on and try to run my tests with it running I see no errors but the app never launches in the emulator. The are my caps:

caps = {
'platformName' => 'Android',
'platformVersion' => '5.0.2', 
'app' => '/Users/ds/projects/op/app/platforms/android/build/outputs/apk/testing_app.apk',
'deviceName' => 'training', 
'avd' => 'training',
'avdLaunchTimeout' => '300000'

}

This is the stack trace i this case:

info: Client User-Agent string: appium/ruby_lib/8.0.2
info: *************************************
info: *************************************
info: *************************************
info: *************************************
info: *************************************
info: *************************************
info: *************************************
info: *************************************
info: ****        NEW SESSION           ***
info: ****        NEW SESSION           ***
info: ****        NEW SESSION           ***
info: ****        NEW SESSION           ***
info: ****        NEW SESSION           ***
info: ****        NEW SESSION           ***
info: ****        NEW SESSION           ***
info: ****        NEW SESSION           ***
info: *************************************
info: *************************************
info: *************************************
info: *************************************
info: *************************************
info: *************************************
info: *************************************
info: *************************************

info: [debug] No appActivity desired capability or server param. Parsing from apk.
info: [debug] No appPackage desired capability or server param. Parsing from apk.
info: [debug] Using local app from desired caps: /Users/ds/projects/opp/app/platforms/android/build/outputs/apk/testing_app.apk
info: [debug] Creating new appium session 727a149a-4421-4176-b9b2-68fed9ed10c1
info: Starting android appium

info: [debug] Getting Java version
info: Java version is: 1.7.0_80
info: [debug] Checking whether adb is present
info: [debug] Using adb from /Users/ds/Library/Android/sdk/platform-tools/adb
info: [debug] Parsing package and activity from app manifest
info: [debug] Checking whether aapt is present
info: [debug] Using aapt from /Users/ds/Library/Android/sdk/build-tools/23.0.2/aapt
info: [debug] Extracting package and launch activity from manifest.
info: [debug] executing cmd: /Users/ds/Library/Android/sdk/build-tools/23.0.2/aapt dump badging /Users/ds/projects/opp/app/platforms/android/build/outputs/apk/testing_app.apk
info: [debug] badging package: com.blah.dev.opp
info: [debug] badging act: com.blah.dev.opp.MainActivity
info: [debug] Parsed package and activity are:
info: [debug] Using fast reset? true
info: [debug] Preparing device for session
info: [debug] Checking whether app is actually present
info: [debug] Trying to find training emulator
info: [debug] Getting connected emulators
info: [debug] Getting connected devices…
info: [debug] executing cmd: /Users/ds/Library/Android/sdk/platform-tools/adb devices
info: [debug] 1 device(s) connected
info: [debug] 1 emulator(s) connected
info: [debug] Sending telnet command to device: avd name
info: [debug] Getting running emulator port
info: [debug] Socket connection to device created
info: [debug] Socket connection to device ready
info: [debug] Telnet command got response: training
info: [debug] Found emulator training in port 5556
info: [debug] Setting device id to emulator-5556
info: [debug] Did not launch AVD because it was already running.
info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)
info: [debug] executing cmd: /Users/ds/Library/Android/sdk/platform-tools/adb -s emulator-5556 wait-for-device
info: [debug] executing cmd: /Users/ds/Library/Android/sdk/platform-tools/adb -s emulator-5556 shell “echo ‘ready’”
info: [debug] Starting logcat capture
info: [debug] Getting device API level
info: [debug] executing cmd: /Users/ds/Library/Android/sdk/platform-tools/adb -s emulator-5556 shell “getprop ro.build.version.sdk”
info: [debug] Device is at API Level 21
info: Device API level is: 21
info: [debug] Extracting strings for language: default
info: [debug] executing cmd: /Users/ds/Library/Android/sdk/platform-tools/adb -s emulator-5556 shell “getprop persist.sys.language”
info: [debug] Current device persist.sys.language: en
info: [debug] java -jar “/Applications/Appium.app/Contents/Resources/node_modules/appium/submodules/appium-adb/jars/appium_apk_tools.jar” “stringsFromApk” “/Users/ds/projects/opp/app/platforms/android/build/outputs/apk/testing_app.apk” “/tmp/com.blah.dev.opp” en

info: [debug] No strings.xml for language ‘en’, getting default strings.xml

info: [debug] java -jar “/Applications/Appium.app/Contents/Resources/node_modules/appium/submodules/appium-adb/jars/appium_apk_tools.jar” “stringsFromApk” “/Users/ds/projects/opp/app/platforms/android/build/outputs/apk/testing_app.apk” “/tmp/com.blah.dev.opp”

info: [debug] Reading strings from converted strings.json

info: [debug] Setting language to default
info: [debug] executing cmd: /Users/ds/Library/Android/sdk/platform-tools/adb -s emulator-5556 push “/tmp/com.blah.dev.opp/strings.json” /data/local/tmp

info: [debug] Checking whether aapt is present
info: [debug] Using aapt from /Users/ds/Library/Android/sdk/build-tools/23.0.2/aapt
info: [debug] Retrieving process from manifest.
info: [debug] executing cmd: /Users/ds/Library/Android/sdk/build-tools/23.0.2/aapt dump xmltree /Users/ds/projects/opp/app/platforms/android/build/outputs/apk/testing_app.apk AndroidManifest.xml
info: [debug] Set app process to: com.blah.dev.opp
info: [debug] Not uninstalling app since server not started with --full-reset
info: [debug] Checking app cert for /Users/ds/projects/opp/app/platforms/android/build/outputs/apk/testing_app.apk.
info: [debug] executing cmd: java -jar /Applications/Appium.app/Contents/Resources/node_modules/appium/submodules/appium-adb/jars/verify.jar /Users/ds/projects/opp/app/platforms/android/build/outputs/apk/testing_app.apk

info: [debug] App already signed.

info: [debug] Zip-aligning /Users/ds/projects/opp/app/platforms/android/build/outputs/apk/testing_app.apk
info: [debug] Checking whether zipalign is present
info: [debug] Using zipalign from /Users/ds/Library/Android/sdk/build-tools/23.0.2/zipalign
info: [debug] Zip-aligning apk.
info: [debug] executing cmd: /Users/ds/Library/Android/sdk/build-tools/23.0.2/zipalign -f 4 /Users/ds/projects/opp/app/platforms/android/build/outputs/apk/testing_app.apk /var/folders/l1/wcd0m9kx6676h8dg4bp6n4b80000gn/T/116215-44294-o6lcye/appium.tmp

info: [debug] MD5 for app is cc4c6cf3738408cd77b0203d2711c1b6
info: [debug] executing cmd: /Users/ds/Library/Android/sdk/platform-tools/adb -s emulator-5556 shell “ls /data/local/tmp/cc4c6cf3738408cd77b0203d2711c1b6.apk”

info: [debug] Getting install status for com.blah.dev.opp
info: [debug] Getting device API level
info: [debug] executing cmd: /Users/ds/Library/Android/sdk/platform-tools/adb -s emulator-5556 shell “getprop ro.build.version.sdk”
info: [debug] Device is at API Level 21
info: [debug] executing cmd: /Users/ds/Library/Android/sdk/platform-tools/adb -s emulator-5556 shell “pm list packages -3 com.blah.dev.opp”

info: [debug] App is not installed
info: Installing App
info: [debug] executing cmd: /Users/ds/Library/Android/sdk/platform-tools/adb -s emulator-5556 shell “mkdir -p /data/local/tmp/”

info: [debug] Removing any old apks
info: [debug] executing cmd: /Users/ds/Library/Android/sdk/platform-tools/adb -s emulator-5556 shell “ls /data/local/tmp/*.apk”
info: [debug] No apks to examine
info: [debug] executing cmd: /Users/ds/Library/Android/sdk/platform-tools/adb -s emulator-5556 push “/Users/ds/projects/opp/app/platforms/android/build/outputs/apk/testing_app.apk” /data/local/tmp/cc4c6cf3738408cd77b0203d2711c1b6.apk

info: --> GET /wd/hub/status {}

info: [debug] Responding to client with success: {“status”:0,“value”:{“build”:{“version”:“1.4.13”,“revision”:“c75d8adcb66a75818a542fe1891a34260c21f76a”}},“sessionId”:“727a149a-4421-4176-b9b2-68fed9ed10c1”}
info: <-- GET /wd/hub/status 200 5.647 ms - 156 {“status”:0,“value”:{“build”:{“version”:“1.4.13”,“revision”:“c75d8adcb66a75818a542fe1891a34260c21f76a”}},“sessionId”:“727a149a-4421-4176-b9b2-68fed9ed10c1”}

Any help greatly appreciated.

Sincerely,