I am trying to create an Android project on Windows using Cordova 2.2.0 (PhoneGap). According to this blog post this command should work -
I had the error:
I figured out it is important to use the valid set of characters for package and project names. Specifically:
a-z
, 0-9
and _
(underscore)A-Z
, a-z
, 0-9
and _
(underscore)My project_name was Test-Project
, with a dash for example.
I had the same issue. I was running the command from this location
Harddriv:\cordova-2.1.0\incubator-cordova-android >create "Harddriv:\externalapps\phonegap_projects\HelloWorld\" com.phonegapaapp.helloworld helloworl
The I got the error you mentioned. Then instead i tried relative path to the location as follows
Harddriv:\cordova-2.1.0\incubator-cordova-android >create "..\externalapps\phonegap_projects" com.phonegapaapp.helloworld helloworl
It worked for me!!!
The command:
export PATH=/android-sdks/tools/:$PATH
did the trick for me.
A few things to check to help solve this problem:
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.
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.
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.
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.
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.
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.
Between all of those, you should be able to get an Android project up and running with PhoneGap 2.1.0 or greater.
Please make sure that you haven't given the folder path of an existing folder. Delete the folder if it exist already.
I have also had the same experience with Windows while creating new PhoneGap project. Then I tried with relative path. For my case I wanted to create project under C:\phonegap_projects\ parent folder and my PhoneGap bin was under C:\phonegap\cordova-2.7.0\android\ parent folder. So I tried with, after navigating to C:\phonegap\cordova-2.7.0\android\bin directory:
create ..\..\..\..\phonegap_projects\<name_of_project> <package_name> <name_of_project>
This worked for me.