2

I am using phone gap for developing an cross platform mobile app.Is it must to use the cordova command-line Interface for that???I am not understand the need and the document says that it will work in some specific combination of working environment.please explain usage of cordova command-line Interface????

Thank you

2 Answers 2

1

Yes the CLI (Cordova Command-line Interface) is obligatory when creating and compiling apps for all platforms.

An explanation how you can use it is:

  1. Create a PhoneGap project

    phonegap create hello com.example.hello HelloWorld`
    

  2. Define the platforms you want to support

    phonegap platforms add android
    phonegap platforms add ios
    

  3. Install plugins if you need to use any system functions or API

    phonegap plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-media.git

  4. Compile and install the app on any connected device

    phonegap run android

  5. You can also use it to remove installed plugins

    phonegap local plugin remove org.apache.cordova.core.media

The above example is using reference from the Edge documentation

2
  • Thank you for your answer, and I have another doubt , as mentioned in the document for android developing. is it only possible in Mac or linux environment???? Feb 25, 2014 at 6:22
  • It should work just as fine on a Windows PC. Assuming you have installed Google Android SDK and ADB tools correctly.
    – James Wong
    Feb 25, 2014 at 6:24
1

No actually cordova cli is not needed if you installed phonegap cli.

Phonegap docs is somehow broken since phonegap 3.3 about this and is starting to be corrected in the edge docs (latest version) : in version 3.3 of the docs there was no more mention about the phonegap cli, only cordova cli but phonegap cli still worked.

in the edge docs, for the moment they document phonegap cli in the pages about project creation and cordova cli in the platform guides, so it's not very clear.

In the facts, you can install either cordova cli, or phonegap cli, or both.

phonegap and cordova cli have the same commands with few exceptions :

  • the prepare command mysteriously disapeared from phonegap 3.3
  • with phonegap cli you need to prefix some commands with local if you want to build locally
  • the phonegap cli allows to launch builds on adobe's cloud using phonegap build

If you don't need to use phonegap build, I suggest you to use only cordova cli.

And to answer your questio in comment in other answer, using cordova cli, you will be able to build locally for any supported platform with the following exceptions :

  • IOS local build is possible only in OSX
  • Windows 8 and Windows phone local builds require Windows (windows phone 8 requires to install the latest sdk that only installs on Windows 8, so you can't even build locally windows phone 8 projects on a windows 7 or below)

So android local build is possible on osx, linux or windows.

It is possible to install cordova without using the cli (download a zip) but then installing plugins is more complicated and I don't think there's any more some docs explaining what to do with the zip.

I hope this helps you to have a clearer understanding about cordova and phonegap.

1
  • If these are the edge docs : docs.phonegap.com/en/edge , they all seem to be mentioning cordova now. so i will follow your suggestion and use cordova only.
    – commonpike
    Oct 6, 2014 at 11:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.