shadyinside
shadyinside

Reputation: 630

Installing PhoneGap Cordova 3.0

I was using phonegap 2.9 for development, it was pretty easy installing that but, phonegap 3.0 uses some nodejs and command line for installation. I found this tutorial but I am stuck at one step. untill this line,

   npm install -g plugman.

it is working, but after this step there is a line,

Then change to the working directory to the project directory.

I can't figure this out and getting an error when i run

cordova -d platform add android

This is the error i am facing,

C:\Users\Comp\AppData\Roaming\npm\node_modules\cordova\src\util.js:57
        throw new Error('Current working directory is not a Cordova-based
              ^
Error: Current working directory is not a Cordova-based project.
at Object.module.exports.cdProjectRoot (C:\Users\Comp\AppData\Roaming\npm\no
de_modules\cordova\src\util.js:57:19)
at CLI.platform (C:\Users\Comp\AppData\Roaming\npm\node_modules\cordova\src\
platform.js:35:36)
at new CLI (C:\Users\Comp\AppData\Roaming\npm\node_modules\cordova\src\cli.j
s:109:30)
at Object.<anonymous> (C:\Users\Comp\AppData\Roaming\npm\node_modules\cordov
a\bin\cordova:41:16)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)

Any help would be appreciated.

Upvotes: 0

Views: 1365

Answers (1)

Dick van den Brink
Dick van den Brink

Reputation: 14499

I think you haven't created a new project with: cordova create [PATH] [ID] [NAME]

This will create a .cordova, platform and www folder. Things are a bit different when you use 3.3, you won't have a .cordova folder in that case but that doesn't really matter.

After running the create command you should add the android platform (after cd-ing into the path you entered with the cordova create command) with "cordova platform add android". Now you should copy the contents of your 2.9 app www folder to the www folder Cordova created.

After running "cordova build android" you will notice that it copied the www folder to "platforms/android/assests/www", you should never change things here because running the cordova build android command will overwrite it.

More info on the following page: http://cordova.apache.org/docs/en/3.2.0/guide_platforms_android_upgrading.md.html#Upgrading%20Android

Upvotes: 1

Related Questions