Phone Gap with Android – Hello World App

posted in: Uncategorized | 0

 Awhile ago we started building an Bing Maps app for a client using Phone Gap and initially targeting iPhone. Now that we’re happy with the functionality we’re looking at the Android version. Today I was trying to get to step one…setup the environment and have a “hello world” app run.

I learnt/reinforced in my mind a few things today:

  • Skimming instructions and not following ever step precisely = more pain than could be gained by rushing in.
  • Just cause something isn’t working doesn’t mean I’m an idiot – it might actually not work.

To start, I needed to set up my computer with the right tools for developing in Android. The PhoneGap site has a good overview on how to do this. My biggest recommendation here is to read the instructions CAREFULLY and not skip over steps or skim through it. I faced a few issues by jumping the gun a bit. While i could call “java” from a command prompt the %JAVA_HOME% variable wasn’t set correctly so it took me a while of scratching my head before I retraced my steps and did it properly.

What struck me coming from a environment like .Net again was how 80’s the setup all felt. Here I was setting ENVIRONMENT and PATH variables – cutting and pasting paths out of explorer like I did many years ago.

After I created the blank project running up the blank application was easy the first time. It’s cool with the number of devices you can configure to deploy to. My first problem was that I couldn’t seem to run my app more than once on the same emulator. I tried keeping it open, I tried closing and re-deploying. The only thing that consistently worked was deleting, creating and running. This is really time consuming as the emulator takes quite awhile to spin up the first time.

logcat

This can’t be right, I’m clearly doing SOMETHING wrong. I retrace my steps and can’t see anything obvious I’ve done wrong. In my LogCat window I’m getting the above “Unexpected value from nativeGeoEnabledTags: 0” filling up my log window but only the 2nd time I try to use an emulator. After a bit of searching I find a few other people have had the same problem here and here. I tried installing to different directories, uninstall / reinstall and still came across the same issue. I don’t have a real device so I take one of the suggestions and run the device as an ATOM rather than INTEL and “tada” I am actually able to run my blank app twice in a row.

It is interesting to try out these other developer environments I either haven’t used or haven’t used in many years and see what they are like and experience their pain points as a “newbie”. It definitely makes me appreciate the tooling I have in Visual Studio.

 

Technorati Tags: ,