An unexpected error occurred: ANDROID_BIN="${ANDROID_BIN:=$( which android )}" exited with 1
With PhoneGap, everytime I try to create a new Android project from the terminal, I get this annoying error:
An unexpected error occurred: ANDROID_BIN="${ANDROID_BIN:=$( which android )}" exited with 1
Luckily, this workaround always seems to work for me:
source ~/.bash_profile
After sourcing my bash profile, then re-running the create command, it completes successfully.
Here are my typical project create commands, the error always comes after the first ./create attempt, then sourcing the bash profile, and re-running the ./create command fixes it:
cd ~/Desktop/phonegap-2.7.0/lib/android/bin ./create ~/Desktop/phonegap-code/MyProject com.mycompany.myproject MyProject source ~/.bash_profile ./create ~/Desktop/phonegap-code/MyProject com.mycompany.myproject MyProject
Please note that the ~/Desktop/phonegap-code/MyProject direct SHOULD NOT exist before running the create command, or else you may run into problems.
I was under the impression ~/.bash_profile was supposed to be automatically sourced when you log in, but maybe not? Who knows, who cares? As long as it works, whatever.