Could not find adb. Please set the ANDROID_HOME environment variable with the Android SDK root directory path

@Donald Yeah Donald Manually refers to starting the UI application.
As you said I have tried with the node executable in my system with Android capabilities.
It worked very well. The emulator was launched and the application also opened.

I attached my terminal logs here:

CH1107:~ selvakumar$ node /Applications/Appium.app/Contents/Resources/node_modules/appium/bin/appium.js --address 127.0.0.1 --port 4723 --full-reset --device-name “” --platform-name Android --platform-version “4.2.2” --app “/Users/selvakumar/Documents/Apks/autoInsurance.apk” --avd “Test1” --browser-name Android -l

info: [debug] Starting Appium in pre-launch mode
info: Pre-launching app
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 command line: /Users/selvakumar/Documents/Apks/autoInsurance.apk
info: [debug] Creating new appium session 524e7fea-f34c-45ab-952c-d62f6a1faf59
info: Starting android appium
info: [debug] Getting Java version
info: Java version is: 1.6.0_65
info: [debug] Checking whether adb is present
info: [debug] Using adb from /Users/selvakumar/Documents/android-sdk-macosx/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/selvakumar/Documents/android-sdk-macosx/build-tools/22.0.1/aapt
info: [debug] Extracting package and launch activity from manifest.
info: [debug] executing cmd: /Users/selvakumar/Documents/android-sdk-macosx/build-tools/22.0.1/aapt dump badging /Users/selvakumar/Documents/Apks/autoInsurance.apk
info: [debug] badging package: com.htcindia.autoinsurance
info: [debug] badging act: com.htcindia.autoinsurance.SplashActivity
info: [debug] Parsed package and activity are: com.htcindia.autoinsurance/com.htcindia.autoinsurance.SplashActivity
info: [debug] Using fast reset? false
info: [debug] Preparing device for session
info: [debug] Checking whether app is actually present
info: [debug] Trying to find Test1 emulator
info: [debug] Getting connected emulators
info: [debug] Getting connected devices...
info: [debug] executing cmd: /Users/selvakumar/Documents/android-sdk-macosx/platform-tools/adb devices
info: [debug] 0 device(s) connected
info: [debug] 0 emulator(s) connected
info: [debug] Launching Emulator with AVD Test1, launchTimeout 120000ms and readyTimeout 120000ms
info: [debug] Checking whether emulator is present
info: [debug] Using emulator from /Users/selvakumar/Documents/android-sdk-macosx/tools/emulator
info: [debug] Trying to find Test1 emulator
info: [debug] Getting connected emulators
info: [debug] Getting connected devices...
info: [debug] executing cmd: /Users/selvakumar/Documents/android-sdk-macosx/platform-tools/adb devices
info: [debug] 0 device(s) connected
info: [debug] 0 emulator(s) connected
info: [debug] Trying to find Test1 emulator
info: [debug] Getting connected emulators
info: [debug] Getting connected devices...
info: [debug] executing cmd: /Users/selvakumar/Documents/android-sdk-macosx/platform-tools/adb devices
info: [debug] 0 device(s) connected
info: [debug] 0 emulator(s) connected
info: [debug] Trying to find Test1 emulator
info: [debug] Getting connected emulators
info: [debug] Getting connected devices...
info: [debug] executing cmd: /Users/selvakumar/Documents/android-sdk-macosx/platform-tools/adb devices
info: [debug] 0 device(s) connected
info: [debug] 0 emulator(s) connected
error: Unable to start Emulator: HAX is working and emulator runs in fast virt mode

info: [debug] Trying to find Test1 emulator
info: [debug] Getting connected emulators
info: [debug] Getting connected devices...
info: [debug] executing cmd: /Users/selvakumar/Documents/android-sdk-macosx/platform-tools/adb devices
info: [debug] 0 device(s) connected
info: [debug] 0 emulator(s) connected
info: [debug] Trying to find Test1 emulator
info: [debug] Getting connected emulators
info: [debug] Getting connected devices...
info: [debug] executing cmd: /Users/selvakumar/Documents/android-sdk-macosx/platform-tools/adb devices
info: [debug] 0 device(s) connected
info: [debug] 0 emulator(s) connected
info: [debug] Trying to find Test1 emulator
info: [debug] Getting connected emulators
info: [debug] Getting connected devices...
info: [debug] executing cmd: /Users/selvakumar/Documents/android-sdk-macosx/platform-tools/adb devices
info: [debug] 0 device(s) connected
info: [debug] 0 emulator(s) connected
info: [debug] Trying to find Test1 emulator
info: [debug] Getting connected emulators
info: [debug] Getting connected devices...
info: [debug] executing cmd: /Users/selvakumar/Documents/android-sdk-macosx/platform-tools/adb devices
info: [debug] 0 device(s) connected
info: [debug] 0 emulator(s) connected
info: [debug] Trying to find Test1 emulator
info: [debug] Getting connected emulators
info: [debug] Getting connected devices...
info: [debug] executing cmd: /Users/selvakumar/Documents/android-sdk-macosx/platform-tools/adb devices
info: [debug] 0 device(s) connected
info: [debug] 0 emulator(s) connected
info: [debug] Trying to find Test1 emulator
info: [debug] Getting connected emulators
info: [debug] Getting connected devices...
info: [debug] executing cmd: /Users/selvakumar/Documents/android-sdk-macosx/platform-tools/adb devices
info: [debug] 0 device(s) connected
info: [debug] 0 emulator(s) connected
info: [debug] Trying to find Test1 emulator
info: [debug] Getting connected emulators
info: [debug] Getting connected devices...
info: [debug] executing cmd: /Users/selvakumar/Documents/android-sdk-macosx/platform-tools/adb devices
info: [debug] 0 device(s) connected
info: [debug] 0 emulator(s) connected
info: [debug] Trying to find Test1 emulator
info: [debug] Getting connected emulators
info: [debug] Getting connected devices...
info: [debug] executing cmd: /Users/selvakumar/Documents/android-sdk-macosx/platform-tools/adb devices
info: [debug] 0 device(s) connected
info: [debug] 0 emulator(s) connected
info: [debug] Trying to find Test1 emulator
info: [debug] Getting connected emulators
info: [debug] Getting connected devices...
info: [debug] executing cmd: /Users/selvakumar/Documents/android-sdk-macosx/platform-tools/adb devices
info: [debug] 0 device(s) connected
info: [debug] 0 emulator(s) connected
info: [debug] Trying to find Test1 emulator
info: [debug] Getting connected emulators
info: [debug] Getting connected devices...
info: [debug] executing cmd: /Users/selvakumar/Documents/android-sdk-macosx/platform-tools/adb devices
info: [debug] 0 device(s) connected
info: [debug] 0 emulator(s) connected
info: [debug] Trying to find Test1 emulator
info: [debug] Getting connected emulators
info: [debug] Getting connected devices...
info: [debug] executing cmd: /Users/selvakumar/Documents/android-sdk-macosx/platform-tools/adb devices
info: [debug] 0 device(s) connected
info: [debug] 0 emulator(s) connected
info: [debug] Trying to find Test1 emulator
info: [debug] Getting connected emulators
info: [debug] Getting connected devices...
info: [debug] executing cmd: /Users/selvakumar/Documents/android-sdk-macosx/platform-tools/adb devices
info: [debug] 0 device(s) connected
info: [debug] 0 emulator(s) connected
info: [debug] Trying to find Test1 emulator
info: [debug] Getting connected emulators
info: [debug] Getting connected devices...
info: [debug] executing cmd: /Users/selvakumar/Documents/android-sdk-macosx/platform-tools/adb devices
info: [debug] 0 device(s) connected
info: [debug] 0 emulator(s) connected
info: [debug] Trying to find Test1 emulator
info: [debug] Getting connected emulators
info: [debug] Getting connected devices...
info: [debug] executing cmd: /Users/selvakumar/Documents/android-sdk-macosx/platform-tools/adb devices
info: [debug] 0 device(s) connected
info: [debug] 0 emulator(s) connected
info: [debug] Trying to find Test1 emulator
info: [debug] Getting connected emulators
info: [debug] Getting connected devices...
info: [debug] executing cmd: /Users/selvakumar/Documents/android-sdk-macosx/platform-tools/adb devices
info: [debug] 0 device(s) connected
info: [debug] 0 emulator(s) connected
info: [debug] Trying to find Test1 emulator
info: [debug] Getting connected emulators
info: [debug] Getting connected devices...
info: [debug] executing cmd: /Users/selvakumar/Documents/android-sdk-macosx/platform-tools/adb devices
info: [debug] 0 device(s) connected
info: [debug] 0 emulator(s) connected
info: [debug] Trying to find Test1 emulator
info: [debug] Getting connected emulators
info: [debug] Getting connected devices...
info: [debug] executing cmd: /Users/selvakumar/Documents/android-sdk-macosx/platform-tools/adb devices
info: [debug] 0 device(s) connected
info: [debug] 0 emulator(s) connected
info: [debug] Trying to find Test1 emulator
info: [debug] Getting connected emulators
info: [debug] Getting connected devices...
info: [debug] executing cmd: /Users/selvakumar/Documents/android-sdk-macosx/platform-tools/adb devices
info: [debug] 0 device(s) connected
info: [debug] 0 emulator(s) connected
info: [debug] Trying to find Test1 emulator
info: [debug] Getting connected emulators
info: [debug] Getting connected devices...
info: [debug] executing cmd: /Users/selvakumar/Documents/android-sdk-macosx/platform-tools/adb devices
info: [debug] 0 device(s) connected
info: [debug] 0 emulator(s) connected
info: [debug] Trying to find Test1 emulator
info: [debug] Getting connected emulators
info: [debug] Getting connected devices...
info: [debug] executing cmd: /Users/selvakumar/Documents/android-sdk-macosx/platform-tools/adb devices
info: [debug] 0 device(s) connected
info: [debug] 0 emulator(s) connected
info: [debug] Trying to find Test1 emulator
info: [debug] Getting connected emulators
info: [debug] Getting connected devices...
info: [debug] executing cmd: /Users/selvakumar/Documents/android-sdk-macosx/platform-tools/adb devices
info: [debug] 0 device(s) connected
info: [debug] 0 emulator(s) connected
info: [debug] Trying to find Test1 emulator
info: [debug] Getting connected emulators
info: [debug] Getting connected devices...
info: [debug] executing cmd: /Users/selvakumar/Documents/android-sdk-macosx/platform-tools/adb devices
info: [debug] 0 device(s) connected
info: [debug] 0 emulator(s) connected
info: [debug] Trying to find Test1 emulator
info: [debug] Getting connected emulators
info: [debug] Getting connected devices...
info: [debug] executing cmd: /Users/selvakumar/Documents/android-sdk-macosx/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: Test1
info: [debug] Found emulator Test1 in port 5554
info: [debug] Setting device id to emulator-5554
info: [debug] Waiting until emulator is ready
info: [debug] executing cmd: /Users/selvakumar/Documents/android-sdk-macosx/platform-tools/adb -s emulator-5554 shell "getprop init.svc.bootanim"
info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)
info: [debug] executing cmd: /Users/selvakumar/Documents/android-sdk-macosx/platform-tools/adb -s emulator-5554 wait-for-device
info: [debug] executing cmd: /Users/selvakumar/Documents/android-sdk-macosx/platform-tools/adb -s emulator-5554 shell "echo 'ready'"
info: [debug] Starting logcat capture
info: [debug] Getting device API level
info: [debug] executing cmd: /Users/selvakumar/Documents/android-sdk-macosx/platform-tools/adb -s emulator-5554 shell "getprop ro.build.version.sdk"
info: [debug] Device is at API Level 17
info: Device API level is: 17
info: [debug] Extracting strings for language: default
info: [debug] executing cmd: /Users/selvakumar/Documents/android-sdk-macosx/platform-tools/adb -s emulator-5554 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/node_modules/appium-adb/jars/appium_apk_tools_1.6.jar" "stringsFromApk" "/Users/selvakumar/Documents/Apks/autoInsurance.apk" "/tmp/com.htcindia.autoinsurance" 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/node_modules/appium-adb/jars/appium_apk_tools_1.6.jar" "stringsFromApk" "/Users/selvakumar/Documents/Apks/autoInsurance.apk" "/tmp/com.htcindia.autoinsurance"
warn: Error getting strings.xml from apk
info: [debug] Exception in thread "main" brut.androlib.AndrolibException: Could not decode arsc file
	at brut.androlib.res.decoder.ARSCDecoder.decode(ARSCDecoder.java:54)
	at brut.androlib.res.AndrolibResources.getResPackagesFromApk(AndrolibResources.java:540)
	at brut.androlib.res.AndrolibResources.loadMainPkg(AndrolibResources.java:76)
	at brut.androlib.res.AndrolibResources.getResTable(AndrolibResources.java:68)
	at io.appium.apktools.StringsXML.run(StringsXML.java:84)
	at io.appium.apktools.Main.main(Main.java:31)
Caused by: java.io.IOException: Expected: 0x001c0001, got: 0x00000000
	at brut.util.ExtDataInput.skipCheckInt(ExtDataInput.java:48)
	at brut.androlib.res.decoder.StringBlock.read(StringBlock.java:43)
	at brut.androlib.res.decoder.ARSCDecoder.readPackage(ARSCDecoder.java:100)
	at brut.androlib.res.decoder.ARSCDecoder.readTable(ARSCDecoder.java:81)
	at brut.androlib.res.decoder.ARSCDecoder.decode(ARSCDecoder.java:49)
	... 5 more

warn: Could not get strings, continuing anyway
info: [debug] executing cmd: /Users/selvakumar/Documents/android-sdk-macosx/platform-tools/adb -s emulator-5554 shell "echo '{}' > /data/local/tmp/strings.json"
info: [debug] Checking whether aapt is present
info: [debug] Using aapt from /Users/selvakumar/Documents/android-sdk-macosx/build-tools/22.0.1/aapt
info: [debug] Retrieving process from manifest.
info: [debug] executing cmd: /Users/selvakumar/Documents/android-sdk-macosx/build-tools/22.0.1/aapt dump xmltree /Users/selvakumar/Documents/Apks/autoInsurance.apk AndroidManifest.xml
info: [debug] Set app process to: com.htcindia.autoinsurance
info: [debug] Uninstalling com.htcindia.autoinsurance
info: [debug] executing cmd: /Users/selvakumar/Documents/android-sdk-macosx/platform-tools/adb -s emulator-5554 shell "am force-stop com.htcindia.autoinsurance"
info: [debug] executing cmd: /Users/selvakumar/Documents/android-sdk-macosx/platform-tools/adb -s emulator-5554 uninstall com.htcindia.autoinsurance
info: [debug] App was uninstalled
info: [debug] Checking app cert for /Users/selvakumar/Documents/Apks/autoInsurance.apk.
info: [debug] executing cmd: java -jar /Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-adb/jars/verify.jar /Users/selvakumar/Documents/Apks/autoInsurance.apk
info: [debug] App already signed.
info: [debug] Zip-aligning /Users/selvakumar/Documents/Apks/autoInsurance.apk
info: [debug] Checking whether zipalign is present
info: [debug] Using zipalign from /Users/selvakumar/Documents/android-sdk-macosx/build-tools/22.0.1/zipalign
info: [debug] Zip-aligning apk.
info: [debug] executing cmd: /Users/selvakumar/Documents/android-sdk-macosx/build-tools/22.0.1/zipalign -f 4 /Users/selvakumar/Documents/Apks/autoInsurance.apk /var/folders/np/5brtytwj00z2s9m_t7_09c5m0000gp/T/115526-404-qksl6z/appium.tmp
info: [debug] MD5 for app is 0558b16961dfb119afe15696d2e3ff60
info: [debug] executing cmd: /Users/selvakumar/Documents/android-sdk-macosx/platform-tools/adb -s emulator-5554 shell "ls /data/local/tmp/0558b16961dfb119afe15696d2e3ff60.apk"
info: [debug] Getting install status for com.htcindia.autoinsurance
info: [debug] Getting device API level
info: [debug] executing cmd: /Users/selvakumar/Documents/android-sdk-macosx/platform-tools/adb -s emulator-5554 shell "getprop ro.build.version.sdk"
info: [debug] Device is at API Level 17
info: [debug] executing cmd: /Users/selvakumar/Documents/android-sdk-macosx/platform-tools/adb -s emulator-5554 shell "pm list packages -3 com.htcindia.autoinsurance"
info: [debug] App is not installed
info: Installing App
info: [debug] executing cmd: /Users/selvakumar/Documents/android-sdk-macosx/platform-tools/adb -s emulator-5554 shell "mkdir -p /data/local/tmp/"
info: [debug] Removing any old apks
info: [debug] executing cmd: /Users/selvakumar/Documents/android-sdk-macosx/platform-tools/adb -s emulator-5554 shell "ls /data/local/tmp/*.apk"
info: [debug] Found an apk we want to keep at /data/local/tmp/0558b16961dfb119afe15696d2e3ff60.apk
info: [debug] Couldn't find any apks to remove
info: [debug] Uninstalling com.htcindia.autoinsurance
info: [debug] executing cmd: /Users/selvakumar/Documents/android-sdk-macosx/platform-tools/adb -s emulator-5554 shell "am force-stop com.htcindia.autoinsurance"
info: [debug] executing cmd: /Users/selvakumar/Documents/android-sdk-macosx/platform-tools/adb -s emulator-5554 uninstall com.htcindia.autoinsurance
info: [debug] App was not uninstalled, maybe it wasn't on device?
info: [debug] executing cmd: /Users/selvakumar/Documents/android-sdk-macosx/platform-tools/adb -s emulator-5554 shell "pm install -r /data/local/tmp/0558b16961dfb119afe15696d2e3ff60.apk"
info: [debug] Forwarding system:4724 to device:4724
info: [debug] executing cmd: /Users/selvakumar/Documents/android-sdk-macosx/platform-tools/adb -s emulator-5554 forward tcp:4724 tcp:4724
info: [debug] Pushing appium bootstrap to device...
info: [debug] executing cmd: /Users/selvakumar/Documents/android-sdk-macosx/platform-tools/adb -s emulator-5554 push "/Applications/Appium.app/Contents/Resources/node_modules/appium/build/android_bootstrap/AppiumBootstrap.jar" /data/local/tmp/
info: [debug] Pushing settings apk to device...
info: [debug] executing cmd: /Users/selvakumar/Documents/android-sdk-macosx/platform-tools/adb -s emulator-5554 install "/Applications/Appium.app/Contents/Resources/node_modules/appium/build/settings_apk/settings_apk-debug.apk"
info: [debug] Pushing unlock helper app to device...
info: [debug] executing cmd: /Users/selvakumar/Documents/android-sdk-macosx/platform-tools/adb -s emulator-5554 install "/Applications/Appium.app/Contents/Resources/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: /Users/selvakumar/Documents/android-sdk-macosx/platform-tools/adb -s emulator-5554 shell "ps 'uiautomator'"
info: [debug] No matching processes found
info: [debug] Running bootstrap
info: [debug] spawning: /Users/selvakumar/Documents/android-sdk-macosx/platform-tools/adb -s emulator-5554 shell uiautomator runtest AppiumBootstrap.jar -c io.appium.android.bootstrap.Bootstrap -e pkg com.htcindia.autoinsurance -e disableAndroidWatchers false
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=
info: [debug] [UIAUTOMATOR STDOUT] io.appium.android.bootstrap.Bootstrap:
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
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] Waking up device if it's not alive
info: [debug] Pushing command to appium work queue: ["wake",{}]
info: [debug] [BOOTSTRAP] [debug] Registered crash watchers.
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] [BOOTSTRAP] [debug] Returning result: {"value":true,"status":0}
info: [debug] executing cmd: /Users/selvakumar/Documents/android-sdk-macosx/platform-tools/adb -s emulator-5554 shell "dumpsys window"
info: Unlocking screen
info: [debug] Screen is locked, trying to unlock
info: [debug] Getting device API level
info: [debug] executing cmd: /Users/selvakumar/Documents/android-sdk-macosx/platform-tools/adb -s emulator-5554 shell "getprop ro.build.version.sdk"
info: [debug] Device is at API Level 17
info: [debug] executing cmd: /Users/selvakumar/Documents/android-sdk-macosx/platform-tools/adb -s emulator-5554 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: /Users/selvakumar/Documents/android-sdk-macosx/platform-tools/adb -s emulator-5554 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","status":0}
info: [debug] dataDir set to: /data
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: /Users/selvakumar/Documents/android-sdk-macosx/platform-tools/adb -s emulator-5554 shell "getprop ro.build.version.sdk"
info: [debug] Device is at API Level 17
info: [debug] executing cmd: /Users/selvakumar/Documents/android-sdk-macosx/platform-tools/adb -s emulator-5554 shell "am start -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000 -n com.htcindia.autoinsurance/com.htcindia.autoinsurance.SplashActivity"
info: [debug] Waiting for pkg "com.htcindia.autoinsurance" and activity "com.htcindia.autoinsurance.SplashActivity" to be focused
info: [debug] Getting focused package and activity
info: [debug] executing cmd: /Users/selvakumar/Documents/android-sdk-macosx/platform-tools/adb -s emulator-5554 shell "dumpsys window windows"
info: [debug] executing cmd: /Users/selvakumar/Documents/android-sdk-macosx/platform-tools/adb -s emulator-5554 shell "getprop ro.build.version.release"
info: [debug] Device is at release version 4.2.2
info: [debug] Device launched! Ready for commands
info: [debug] Setting command timeout to the default of 60 secs
info: Welcome to Appium v1.4.1 (REV ce6220829063679bcccf5724515c29569c4a16d9)
info: Appium REST http interface listener started on 127.0.0.1:4723
info: [debug] Non-default server args: {"app":"/Users/selvakumar/Documents/Apks/autoInsurance.apk","address":"127.0.0.1","fullReset":true,"launch":true,"avd":"Test1","deviceName":"","platformName":"Android","platformVersion":"4.2.2","browserName":"Android"}
info: Console LogLevel: debug

@Donald I have attached my JAVA CODE by editing the question.

@wreed What could be given in the Eclipse local environment tab. Can you explain what needs to be given in that tab. Because when I gone through, I didn’t find any Android_Home variables.

Hi Ashok,

As you said that you did changes in .bashrc and after that node terminal command for appium server is working fine Which is Great! a step closer :slight_smile: .Actually .bashrc file is used for setting variables used by interactive login shells. If you want those environment variables available in Eclipse you need to put them in /etc/environment. if you don’t know how to set /etc/environment, its just a google search away.

You can also define an environment variable that is visible only within Eclipse.
Go to Run -> Run Configurations… and Select tab “Environment”.

Hope This will help you ! Just give a try and let us know.
Thanks,
Donald

Sorry if I’m not being clear. I think Donald had a good point. For me, when I go to run configurations in Eclipse & hit ‘select’, it gives me a list of local variables that I’ve already set & I just pick the one(s) I need. If one is not in there that you need just hit ‘new’, and then set it for Eclipse’s use.

Hello Ashok i had the same issue when i was working in a company before.I usually create a bash file and then use that to open programatically…Here is my code …This will solve the problem

#!/bin/bash
export ANDROID_HOME=/Users/Robot/Downloads/Xamarin/android-sdk-mac_x86
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/platform-tools
export PATH=$PATH:$ANDROID_HOME/build-tools
‘/Applications/Appiumold.app/Contents/Resources/node/bin/node’ ‘/Applications/Appiumold.app/Contents/Resources/node_modules/appium/bin/appium.js’ --address 127.0.0.1 --command-timeout 7200 --pre-launch --app ‘/Users/Robot/Desktop/Exampletools.apk’ --app-pkg Exampletools.exampletool --app-activity bott.droid.SplashScreenActivity --app-wait-activity bott.droid.SplashScreenActivity

As you can see this is the code i stored in my file in Mac pc.Every time you programatically start it needs to set variables each time.I dont understand what is the problem :slight_smile: I hope this fixes your problem

I think if you add the above first 4 lines to ur java code you can make it work.

@Donald @wreed I set those environmental as System-wide environmental variables. and it works now.

Previously I didn’t set the environmental variable(ANDROID_HOME) as system-wide variable, that is the reason why the ANDROID_HOME variable is invisible in Eclipse Environment settings.

To set the ANDROID_HOME as System-wide environmental variable, I have used the following commands in terminal and some settings in Eclipse.

Terminal:

  1. Run sudo nano /etc/launchd.conf
  2. Add setenv ANDROID_HOME /Users/selvakumar/Documents/android-sdk-macosx
  3. Then either restart or run launchctl < /etc/launchd.conf; sudo launchctl < /etc/launchd.conf

Eclipse:
Then the variable becomes visible in the Eclipse–> Run Configurations–> Environment -->Select–>ANDROID_HOME then I checked the ANDROID_HOME variable and click apply. Run the code with your new Run configuration settings. That made my code to work.

@kasperavi Thanks Avinash! Let me check with your idea too…

Thanks a lot to everyone! The big show came to an end :smile: :grinning:

2 Likes

Hi AshokKumar,

I am facing same issue and am new to mac os. Could you please elaborate the steps for setting the ANDROID_HOME as System-wide environmental variables. Currently I am stuck in second step.

Note;- This issue I am getting when starting appium server programmatically. Through Appium GUI it is working fine and am able to run test scripts.

Please find the following Terminal steps.

  1. sudo nano /etc/launchd.conf —> its launching /etc/launched.conf file
  2. I am able enter “setenv ANDROID_HOME /Users/mobilelabmac/Desktop/adt-bundle-mac-x86_64-20140702/sdk/” in /etc/launched.conf file
  3. Save File Using Command + S
  4. Restarting machine

I can’t see the ANDROID_HOME in Select Environment Variables List in Eclipse.

Please elaborate how to save file and after saving /etc/launched.conf file how to run the third steps commands.

I am getting error “No such file error” when I am hitting the command “launchctl < /etc/launchd.conf; sudo launchctl < /etc/launchd.conf” on Terminal

Thanks in advance.

@prasad Sorry for the delay reply.

If you are able execute your scripts through Appium GUI, can you share your Appium start up code and logs

Eclipse is unable to field SDK path. delete and restore or download eclipse.
Thanks

This solution worked for me. Thanks a lot!!

how to tell eclipse to use local varaiables???

Did you use the link provided? If so, which part is confusing?

@nitishram, i had the same issue and got it resolved by adding ANDROID_HOME in the Run Configurations > Environment tab of eclipse. hope it helps to solve yours.

2 Likes

Thanks for replying @praveenmukilan
i have set android path as told by u.but error still exists
my sdk folder is kept in D drive is it k??

reinstalling adt in eclipse solves my problem and working fine

1 Like

Worked perfectly for me…thanx for the response

It worked for me as well. Thanks.