1

I was going through the PhonGap Documentation about how to package your HTML/JS/CSS to a platform specific "native app". They have maintained separate documentations for the separate Cordova versions which seems fine.

I essentially understand most of the things there. But the confusion I have is the disparity or the loss of information in the documentation from the older ones to the newer ones. For an instance, if you take a look at this documentation for the version 2.1.0 about setting up the android project and scroll a bit down, they have mentioned such things:

  • In the root directory of your project, create two new directories:
    • /libs
    • assets/www
  • Copy cordova-2.0.0.js from your Cordova download earlier to assets/www
  • Copy cordova-2.0.0.jar from your Cordova download earlier to /libs

  • Copy xml folder from your Cordova download earlier to /res

....

  • Change the class's extend from Activity to DroidGap
  • Replace the setContentView() line with super.loadUrl("file:///android_asset/www/index.html");

... and so on which clearly mentions the steps to follow while migrating or creating an app for a specific platform. But upwards from the version 2.1.0, these information are missing.

Like in the newer documentations, all they have is just the regular android setup stuffs and android hello world which we can obviously find on the official android documentation. I tried searching the whole documentation for that version and I could not find any information regarding the steps I mentioned above in the older documentation.

Otherwise how are the readers supposed to know those steps? Am I missing something here or have they provided?

1 Answer 1

2

PhoneGap is constantly being improved upon, and one aspect of the platform that has continued to see development is initializing a project. As new versions are released, there have been steps taken to automate and make this process easier.

In PhoneGap 2.1.0, as you've noted, it appears as if none of the initialization process was automated. The documentation that you linked to describes the steps to set up a native Android project. The developer is then instructed, as you described, to modify this project manually, adding the source files, libraries, and folder structure necessary for PhoneGap to function.

The PhoneGap version that I'm most familiar with is 2.5.0. The getting started guide for this version can be found here. In 2.5.0, the developer is directed to navigate to a specific directory in their Cordova distribution and run a script from the command line. This script takes arguments relating to where your project will live and some other metadata about it, then creates the native project for you and performs the aforementioned steps of creating the PhoneGap specific project structure and adding the source files. In addition, it starts you off with a test application, which you can examine and run to start you off, basically their version of "Hello World".

I haven't had the opportunity to use PhoneGap 3.0.0 yet, but it appears as though they've made our lives as developers even easier by moving the bootstrap process from a script to a program installed using node.js' npm. The usage is mostly the same as 2.5.0, where you pass the metadata about the program you're developing to the script, but now you can run it from anywhere, instead of needing to find the script deep in your downloaded cordova files. I suspect this process will result in something similar to 2.5.0, where the entire project structure is created for you, including relevant PhoneGap source files, with a helpful "Hello World" type program to get you started.

So, in summation, these parts of the documentation that you describe have been removed because PhoneGap has automated their bootstrap process and now does all this work for you!

If you're interested in seeing some of the further differences between versions of PhoneGap, you can view or download their project, including the documentation, on github. They tag each version increase, so you can revert to one of the tagged commits to go through and see everything that's different in the source code and docs from release to release.

4
  • Yes I understood that they have automated the initial setup and as well as the whole development cycle process which you can carry out from the command line. But even though following everything as they said I was stuck in this part of adding the android platform docs.phonegap.com/en/3.0.0/…. Turns out if I nagivate to the appropriate cordova folder in my project there is no cordova or platform batch file at all and hence always the no recognized command error. I am using windows 7. Do you have any idea of it?
    – SASM
    Commented Aug 6, 2013 at 9:56
  • Have you set up the Android SDK and added the necessary directories to your PATH, as described here: docs.phonegap.com/en/3.0.0/…
    – MattDavis
    Commented Aug 6, 2013 at 14:26
  • I have done everything as mentioned. In fact I can use CLI to generate the skeleton of the project, but after that adding the platforms and building the project doesnt work. The cordova folder inside the project does not have all the files needed to run the commands I guess.
    – SASM
    Commented Aug 6, 2013 at 14:34
  • It sounds like that may be the start of a new question, probably one that's more relevant on StackOverflow. If you can post something there that lists the setup steps that you followed and the exact error that you're getting, someone may be able to help you out.
    – MattDavis
    Commented Aug 8, 2013 at 14:19

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.