Android setup failed in Appium Mac

i tried to launch an Android application in Appium Mac build. i have set all the device capabilties but still getting this error… I also checked with Appium doctor,its says everything is installed and works fine.

BUt still getting the below error

Launching Appium with command: ‘/Applications/Appium.app/Contents/Resources/node/bin/node’ lib/server/main.js --address “127.0.0.1” --port “4725” --command-timeout “10000” --pre-launch --automation-name “Appium” --platform-name “Android” --platform-version “4.4” --app “/Users/244325/Desktop/AndroidQAPOC-1.3-CDC2.apk” --no-reset --app-pkg “com.lexisnexis.lawschool.qa” --app-wait-package “com.lexisnexis.lawschool.qa”

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] Using local app from command line: /Users/244325/Desktop/AndroidQAPOC-1.3-CDC2.apk

info: [debug] Creating new appium session 00e51613-20a9-43f4-90b9-36fc88b99df4
info: Starting android appium
info: [debug] Getting Java version

info: [debug] Cleaning up android objects

error: Could not pre-launch appium: Error: ‘java -version’ failed. Error: Command failed: /bin/sh -c java -version
Unable to locate an executable at “/Library/Java/JavaVirtualMachines/jdk1.7.0_08.jdk/Contents/Home/bin/bin/java” (-1)

Hi,

Try setting JAVA_HOME in your .bash_profile as /Library/Java/JavaVirtualMachines/jdk1.7.0_08.jdk/Contents/Home
Make sure the Appium-Doctor picks it up.
home folder contains all the excecutables needed for Java to work flawlessly whereas your path is nested too deep and provides just one exe file.

Cheers,
Camy