Create PhoneGap Apps Without Installing PhoneGap – Part 1

Part I - Wherein I Complain A Lot

PhoneGap has made a big splash in the mobile app development world the last couple of years, allowing developers to write an application using just HTML, CSS, and Javascript, and to then be able to convert that web app into native apps for all of the major mobile platforms. The ability to write a cross-platform app in a single pass, utilizing well known, existing languages, is an immense help to developers all over. Even more so for hobby developers, or those who are just looking to get their feet wet in the app development world.

At the same time, the initial installation process for PhoneGap can be a bit daunting. Personally, I spent a lot of time working through several tutorials attempting to get PhoneGap installed on my system, only to reach a wall in the process after a couple hours that prevented me from being able to use it. Even finding the best installation tutorials is a bit of a pain. Starting at PhoneGap's site, you have to find the "Get Started" link, hiding in the "Developer" dropdown menu. Bafflingly, this link takes you to the main page of the API Reference. Only by looking towards the bottom of the sidebar can you find the "Getting Started Guides" link. Then you are presented with a list of different guides, each catered to a specific mobile OS platform.

Pointing to actual guides in PhoneGap's documentation
Here's what you're actually looking for

"But wait!", you may be saying (as I certainly was), "I thought PhoneGap was cross-platform?" Well, it is; but in order to do an installation of PhoneGap, you must install the necessary development environment for each platform you wish to publish to. This means the Android SDK, XCode, Visual Studio, etc. Which immediately presented a problem for me. My desktop, and pretty much every computer I operate, runs Linux. It appeared I would be unable to compile directly for iOS or Windows Phone, as neither offers development environments for Linux. In any case, I figured I would press on with the Android SDK, just to have some way of getting started with it. I could figure out compiling for cross-platform at a later stage.

I went through the complete installation of the Android SDK, which is not a quick process. Relatively easy to do, but it takes quite a while. After going through that, I downloaded and extracted the PhoneGap files. Next up in the tutorial was a whole section on setting up PATH environments. Oddly again, they only offer instructions for OSX and Windows. Fortunately the instructions for Linux happen to be the same as Mac (and also fortunate that I knew this). Would have been very simple for the guide to just change the title of that section to "Setup your PATH environment variable on Mac OS *and Linux*". I suppose that's the price I continue to pay for being a Linux user. I could comment on the fact that forcing users to modify PATH variables should pretty much be avoided in this day and age, but the target audience should have a decent grasp of being able to do things like this anyways. And it's not entirely PhoneGap's fault.

Finally I get to the stage of actually creating a new project. Ran the terminal command and...alas, I got errors. Back to Googling for answers to find out what these errors mean. I solve one, then a second error, and finally reach the stage where I discover that I need to install the Java compiler. Fine, fine, I suppose that makes sense. Not sure how I made it this far in the process before finding that out, though. Here's the part where I ran in to the current hurdle that I haven't yet been able to overcome, as I wasn't able to install the Java compiler. The reasons for that are outside the scope of this article, and just has to do with my current installation, so its merely my own problem.

PC LOAD LETTER error on printer
PC LOAD LETTER?! Argh!! (Okay, I didn't really get this error)

The problem was that I had just effectively wasted several hours trying to make this work, only to end up with a bunch of huge files on my computer that I could do nothing with. I figured there had to be a better way, but it was going to wait for another day.

Next up: I stop whining and provide solutions!