Android Development - Quick Start with PhoneGap (Part 1)

When I mention to people I write the Android app or two they're surprised I find the time to put an app together before they dive into their most recent app idea (before conceding that it's already be done by someone beforehand except for "one little thing" but that's another story) and explain that they wish they could "do an app". I usually use this moment to point out how many kids (literally high school students) have a pretty good grip on app development and although a few suggest that's because "kids today" supposedly have a better grasp on technology (a point I'd often debate but I'll save that story for another day) and then typically find the room going quiet (social engagement is not my top skill in fairness so I normally use this chance to escape the conversation and go see if I can make another drink last a bit longer or if there's a dog somewhere in the house I can visit)...

Every so often this conversation goes the other way and someone asks "how". Thanks to application frameworks it's actually quite easy to go from idea to prototype and even a fully functional application for many so I figured I'd do a quick series on how to get started with Phone Gap. For those interested, I'm going to be using Windows 10 (although all the frameworks mentioned are multi-platform) and I'll be using the latest versions of everything so be careful if you've got an older build!

So, with the preamble out of the way, let's get Phone Gap installed (we can talk about downsides and limitations of PhoneGap based apps shortly, but for now let's see how quick we can set up a full dev environment!).

Getting the Environment Going

  1. Install Java: Download and Install Java - you can grab it directly from www.java.com (you need it for Android Studio which we'll use largely for it's emulator).
  2. Install AS: Download and install Android Studio - https://developer.android.com/studio/index.html Make a note of install paths, but otherwise you can chose the defaults and launch Android Studio - once launched, you can once again accept the defaults to launch Android Studio.
  3. Check you have the right components: Once it's installed and started up, you may want to double check the emulator's we're planning on using were installed successfully- to do so you can run the Android SDK Manager from the Start Menu but make sure you right click and chose (in Windows 10 from the more menu) the option to "Run as an Administrator" as by default it won't have permission to install these items. In the package manager make sure you've got the Google API's Intel Atom System Image ticked and installed. I actually had a bit of a fight getting this installed seemingly due to a checksum error (https://stackoverflow.com/questions/47719420/sdk-platform-android-8-1-0-cant-download talks about this a bit) - the short fix for this is: A) Grant yourself read-write permissions to "C:\Program Files (x86)\Android\" B) Go to "C:\Program Files (x86)\Android\android-sdk\temp" and extract "platform-27_r01.zip" . The resulting folder with have in it a single folder entitled "android-8.1.0". C) Rename the "android-8.1.0" folder to  "android-27". D) Copy the "android-27" folder to the path "C:\Program Files (x86)\Android\android-sdk\platforms".
  4. Install NodeJS: Download and install NodeJS from https://nodejs.org/en/ - you can chose the LTS version (8.9.4 LTS at the time of writing) choosing the next-next-next finish default options!
  5. Install PhoneGap: Grab PhoneGap from https://www.phonegap.com/getstarted/ again choosing the next-next-next finish default options! I'd highly recommend once this is installed adding the PhoneGap CLI - you can do so by simply launching a command prompt and entering: npm install -g phonegap
  6. Install Cordova: We'll also use Cordova (to link the simulator and app)- again, since we have NPM installed already you can do so by simply launching a command prompt and entering: npm install -g cordova

You should now have all the basics together for your development environment. Next time we'll start putting together a quick app for us and testing it out on the emulator.