Reputation: 26789
I've been following the PhoneGap Getting Started Guide for Android. I'm on the step where it says: Type in ./create <project_folder_path> <package_name> <project_name> then press "Enter"
However, whenever I do this command in the form of ./create ./test2 com.mytest MyTest
I get this error: An error occurred. Deleting project...
I'm in the right directory, and I don't believe I've done anything out of the ordinary in following their steps.
PS I'm on Mac OS X 10.7.5
Update: I tried installing the phonegap-master zip directly as one of the answers suggested. Now I get a new error when I run the command in that android bin directory: An unexpected error occurred: ANDROID_BIN="${ANDROID_BIN:=$( which android )}" exited with 1
Upvotes: 5
Views: 3341
Reputation: 2314
This is probably because of a wrong PATH. You should edit your PATH variable. Refer this blog post for solution.
Upvotes: 0
Reputation: 2689
If you're like me a little bit sloppy with setting up PATH
right away after installation but move from a case to case-sitation notice Phongap's documenation requires /platform-tools
and /tools
to be included!
In my case only /platform-tools
was included and developing worked fine as well as bash access to adb
however the android
executable is located in /tools
so unless you include it which android
will return not match.
To realise this @Nverba's link to github was very helpful as I finally stumbled across the source for create
script:
And searching for "An unexpected [...]" brought up this piece of error handling:
function on_error {
echo "An unexpected error occurred: $previous_command exited with $?"
echo "Deleting project..."
[ -d "$PROJECT_PATH" ] && rm -rf "$PROJECT_PATH"
exit "$?"
}
Upvotes: 2
Reputation: 19399
I had the same issue following this getting start guide. After tearing my hair out for hours I followed this getting started guide which I think is older but worked.
Another thing is that the first getting started guide tells you to download Cordova here and so I was trying to do everything with that download.
Instead download the PhoneGap package from here and from within there you will find the Cordova js and jar files aswell as the xml folder you'll need to create your app.
Upvotes: 0
Reputation: 409
My problem is the incorrect paths to Android SDK. If you follow the instructions straight up, it will tell you to add
export PATH=${PATH}:/Development/android-sdk-macosx/platform-tools:/Development/android-sdk-macosx/tools
to .bash_profile or .profile. I had to change mine to
export PATH=/Users/my_username/Development/android-sdk-macosx/platform-tools:/Users/my_username/Development/android-sdk-macosx/tools:$PATH
Upvotes: 2
Reputation: 4083
I've been having this issue despite having everything set up correctly.
I ended up downloading the Phonegap zip from Github, which has recently been bumped to version 2.3.0
https://github.com/phonegap/phonegap
Using
./create ./my_new_cordova_project com.example.cordova_project_name CordovaProjectName
worked like a charm...
Hope this helps, there are about half a dozed other things that can cause this error, but they have been covered in other answers.
Upvotes: 1
Reputation: 649
you should navigate to the folder that contain the create first, it will be in the "phonegap(that u downloaded from the site)/lib/android/bin"
for example: (on mac)
cd /Users/user_name/Desktop/phonegap/lib/android/bin/
or: (on windows)
cd C:/users/user_name/Desktop/phonegap/lib/android/bin/
then u can complete the code
./create ./test2/MyTest com.mytest MyTest
that's will fix your problem.
Upvotes: 0
Reputation: 21
Try
./create ./test2/MyTest com.mytest MyTest
the project_folder_path should be a non-exist folder
Upvotes: 2