After executing the command to create a project…
./create <PATH_TO_PROJECT_DIR> <COM_PATH> <PROJECT_NAME>
I get the error message:
An unexpected error occurred: ANDROID_BIN="${ANDROID_BIN:=$( which android )}" exited with 1
Deleting project...
Troubleshooting responses:
(acconrad provided a smart checklist here for solving Cordova errors…)
Did you download the correct version of PhoneGap from the correct LOCATION? It appears as if
there are versions of PhoneGap that do not come packaged with
Cordova-2.x.0.jar, which is necessary to run the script. Download here
to obtain PhoneGap with the correct JAR file.
I have followed the instructions at the official Apache Cordova API Documentation site and downloaded the cordova-android repository from github. The official documentation does not say anything about this jar file and as such I have not executed it.
Did you already create the folder? The documentation claims that you
can use this command as long as the new folder is blank. This is not
true. Make sure the folder does not exist before attempting to create
the project.
Fresh folder path, never created.
Do you have the latest version of Ant? You will need Ant 1.8.0 or
greater to run PhoneGap with Android. Use ant -v to verify your
version.
Ant version 1.8.2, although running the -v flag pops up the following output…
Apache Ant(TM) version 1.8.2 compiled on June 3 2011
Trying the default build file: build.xml
Buildfile: build.xml does not exist!
Build failed
…as if it was trying to build. I assume -v means verbose and ant is trying to build the current director, in which there is no build.xml file, because I’m not building a project with ant, merely finding the version, which is 1.8.2.
Is your .bash_profile/Environment Varibles PATH set properly? The
official documentation has been updated to reflect this, but you will
absolutely need these variables set correctly in order to create the
project.
Both SDK paths have been set & sourced.
Did you update the terminal to reflect your new PATHs? source
.bash_profile or . .bash_profile in your currently open terminal
window so your paths are updated when running the create command.
Haven’t restarted but $PATH outputs the correct android-sdk-macosx paths (platform-tools && tools).
Do you have the correct commons-codec? You may receive an accompanying
error referring to a missing commons-codec file, which you can
download here.
No commons-codec accompanying error is being displayed.
The problem was indeed the PATH variables…
/PATH/TO/android-sdk-maxosx/platform-tools/PATH/TO/android-sdk-maxosx/toolsremoved the macosx from the path name.
Correcting these environment variables in ~/.bash_profile solved this problem.