Setting up an Android environment for PhoneGap

 

Starting to use  PhoneGap – aka Apache Cordova has been a frustrating experience, not because of PhoneGap but because of getting the Android environment set up. The getting started (Android) tutorial for PhoneGap is great. Once I had the environment set up, working through the tutorial took a few minutes. I am not going to reproduce anything that is in that tutorial here, this post is just about how to get to the point where you can work through the tutorial. I’m working on a Mac (Snow Leopard) so these instructions are Mac specific.

 

There are 4 steps:

  1. Downloads
  2. Installing the ADT Eclipse Plugin
  3. Installing the Android SDK
  4. Setting up an Android Virtual Device.

 

1. Downloads

Get started by downloading the major components.

  1. Eclipse Classic 3.7.1
  2. Android SDK R16 MacOSX (Note: This is an ‘SDK starter kit’, see later)
  3. PhoneGap 1.4.1. You don’t need this to set up the Android environment but you will need it for the PhoneGap tutorial so grabbing it while you are downloading stuff makes sense.

I extracted these into 3 separate directories under ~/Applications/ECLIPSE, ~/Applications/ANDR and ~/Applications/PHONEGAP, I don’t think it matters much where they go. Just remember the location.

 

2. Install the Android Developer Tools (ADT) plugin for Eclipse.

Start up Eclipse, I normally do this from the command line so I just executed:

./Applications/ECLIPSE/eclipse/eclipse &

With the brand new install of Eclipse running,  you can  install the ADT plugin:

  1. Help->Install New Software.
  2. Click the ‘Add’ button, top right.
  3. Type ‘ADT Plugin’ in the box labelled ‘Name’
  4. Paste this location “https://dl-ssl.google.com/android/eclipse/” into the box labelled ‘Location’.
  5. Follow the instructions. These are straightforward, so I won’t reproduce them.

 

3. Install the Android SDK

First, tell Eclipse where you put the SDK starter kit. To do this:

  1. Eclipse->Preferences->Android
  2. Paste the location of our SDK into the box and click ‘Apply’

This part is confusing because nothing happens except this:

The SDK Platform Tools component is missing!??

I spent a long time wondering what I had done wrong.  In fact this is the expected behaviour, all that this step achieves is to tell Eclipse where the ‘SDK starter kit’ can be found so that in the next step it can install the SDK. Just click ‘OK’ to get rid of the message and ‘OK’ again to close the window.

Now that Eclipse knows where you have put the ‘SDK starter kit’ you can go ahead and install whatever version of the SDK you need.

  1. Window->Android SDK manager
  2. A window appears with all SDKs you might want to install (see below), pick whatever you need and install it.

 

Android SDKs to install

Android SDKs to install

This takes a while, in the end you should see something like this:

Success installing SDK

Success!

Now, if you return to the the Android SDK pages in Eclipse, (Eclipse->preferences->Android) you will see that Eclipse knows about the SDK:

 

Android SDK is installed

The Android SDK is installed!


 

4. Setting up an Android Virtual Device (AVD)

The final piece that you will need to run the PhoneGap sample is to install an Android Virtual Device, this is a ‘phone emulator that is going to display your PhoneGap (Android)  application.

  1. Window->AVD Manager ->New
  2. Give the AVD a name (whatever you want)
  3. Under ‘Target’, select the SDK that you just installed.
  4. Give it a size. I have no idea what is appropriate here, I allocated it 10 (MiB) and things seem to work.

That’s it. If you have followed through this you have everything that you need to run the PhoneGap Android tutorial.

 

Monki Gras

Monki Gras was the best conference I’ve been to for a long time. I have been to some very good conferences over the past few years, so being the best is quite good.  That’s a nice English understatement.

I spent a while this afternoon analysing why it was so good. This is the list of things that I want get from attending a conference -

 

  • To come away with at least 2 ideas to follow up – maybe 3 or 4, but no more than that.
  • To be given sketches, glimpses of what different technologies can do – but I mainly don’t want a whole lot of detail on how.
  • To get the ‘vision thing’.
  • To be entertained.
  • To catch up with old friends and make a few new ones.

 

Monki Gras gave me all of this and more, and I’m tired because it was also hard work. I’m also full of energy and enthusiasm for …. well you may have to wait and see.

Colour me stupid!

Finally – I read the book on HTML5 and CSS3 that has been sitting on my desk since I bought it at JAX London. Well, alright, truthfully – I have read half of it.

Reading books is a good way to learn  – but I find  that technical stuff doesn’t sink in unless I apply what I read somehow.

Since I struggle a bit with the ‘art’ side of web sites I wrote something that makes it a bit easier for me to visualise what colours and fonts will look like when you put them together in a standard sort of ‘blog site’ . It’s beginner style HTML5 so for goodness sake don’t copy it (read the book) ; I used Jan Odvarko’s jscolor library for picking colours.

Here is a link to it – let me know if it’s useful or fun or you can think of more stuff it should do. I hope the usage is self evident. Caveat – it has not been widely tested, if it doesn’t look right in your browser try Chrome or Firefox :-)

 

 

Now I need to read the rest of the

Things I thought I’d never do: Photography

When I started building websites my plan was to do the programming – PHP, CSS and HTML. If the problem is programming I know I can solve it, I may not know how long it will take but I know I can rearrange 1s and 0s in an acceptable fashion. I did not want to do artwork or photography – I’m not much good at either and completely unqualified .

The problem is that it just doesn’t work like that. The person that I’m working for at the moment has a fabulous collection of period costumes for hire, she had the artwork for the site but she needed photographs and without them however good I am at fixing PHP the site still won’t look that good.

With some reluctance I decided that I ought to try and learn how to take photographs. Luckily  I have three nieces and a daughter who all love dressing up, I have a decent camera and we all had a free day on the 27th of December.  We assembled at the Worn to be Wild shop in Alresford to find that my client had laid out several complete sets of costumes – including accessories ranging from a stuffed snake to a saxophone – it was a wonderful day.

 

The quality of the results probably owes more to the costumes, the models and Gimp than to my skill as a photographer. The collection of clothes is really stunning – the catsuit in this shot is is an original 1970′s number  – anyone remember Diana Rigg at Emma Peel in the Avengers?

 

The rest of website is coming along and I’ll put some images on the ‘WORK’ pages in the near future, the layout is pretty much done but there is a lot more wording to do and this is really up to the client to provide. I think she realised that I couldn’t help with that when I thought a Yoda costume was ET. In my defence they are both some sort of small sci-fi film creature – aren’t they?

 

 

 

 

There is no such thing as a free…..

When I started experimenting with WordPress about three months ago a big part of what led me to use WordPress was the astonishing number of free themes. I still think that the free themes are a great idea but I’m a lot more cautious than I was three months ago about what I use.

First – I read this blog which worried me a bit.  Following Siobhan’s instructions I started to check what I was downloading a bit more carefully. I was already downloading from sites that were recommended by some reasonable source (eg Smashing), so I didn’t find as much bad stuff as Siobhan did – but there were things I didn’t like.

Here are the six things that I use regularly now:

To take those in reverse order, turning on debug (just change the flag from ‘false’ to ‘true’ in the wp-config.php file) threw up a few errors I was surprised to find – for example uninitialised variables. I know PHP ‘forgives’ these but I think they are usually a pretty good indicator of sloppy code.

Using the W3C validator also picked out invalid HTML (usually missing closing tags). The CSS validator found a few incorrectly set properties – nothing major but stuff that might be annoying to find and fix.

The theme-check plugin was the most useful – in one case it found dreamweaver files (bad enough in dreamweaver, exceedingly annoying in a WP theme).

None of the themes I looked at failed TAC or the Exploit scanner – but I’ve listed them here because I’d always use them.

None of what I found was too terrible – but it did make me think. Would I buy a paid for theme from a company that released a free theme which didn’t pass these basic checks?  Not a chance!

That doesn’t mean that I think all free themes are bad – there are some great sources (listed in Siobhan’s blog) – but now that I’ve looked at a few I think I’ll be starting with Sandbox and rolling my own in future. At least all the mistakes will be mine :-)

JAX London

I spent two days this week at JAX London – a conference for Java Developers that runs every six months in London. As always it was well organised and had great speakers – I particularly enjoyed James Governer’s keynote and was a bit sad that he had trouble rousing the audience who I suspect had enjoyed the free beer from Atlassian the night before. But James was philosophical about it – as he said, the beer and networking is a pretty important part of the conference.

In a recent post Barry talked about the value of developers attending conferences. In most of my post-conference posts I take a few minutes to rant (mildly) about employers that don’t understand the benefits of sending their developers to this kind of event. But I won’t this time – partly because Barry has said it so well  already and partly because the economy is tough, some people really are struggling to just keep going. So, if you are a software developer in a company where you can see the directors frantically trying to raise another round of venture capital, or where you know they have just lost their best client, or if you can see the stock price plummeting – hang on in there, give them your support and be prepared to look after your own education for a bit. Look out for JAX discounts from the LJC and come to our Open Conference on Saturday 26th November. On the other hand – if your directors are still flying first class and have just awarded themselves another ludicrous bonus – maybe it’s time to question their sincerity when the say they can’t afford to look after your professional development. Time to move on perhaps?

Just like everyone else who attended JAX, I have come back with a whole bunch of new ideas, enough to keep me busy for another six months anyway. I’ve started on one already and it’s going to be a-ma-zing!

 

 

 

Why do you need a website?

If you have a business it is likely that you need a website. Things change fast in this business and the behaviour of consumers has changed to take advantage of technology. People are less likely to find your business through the ‘phone directory and much more likely to cruise around on the internet. If they find a reference to your business – say in one of the online directories – the next thing they will want to do is look at your website. If it doesn’t exist they will move on to a business that has one.

It doesn’t matter how large or small your business is, even if you’re a one or two person outfit and even if you are not selling anything online you probably still need a website.

It’s more than just needing a website – you need a good one. Think of a website as a different sort of shop window – it needs to reflect the character of your business and invite potential customers to step into your shop. Finding your website may be the first interaction that a potential customer has with your company – a poor site may mean it’s the last one.

Websites aren’t just for customers either – they provide a way for potential employees, business partners and investors to gain an impression of your business.

Over the next few months I’ll write a few short posts on your options for establishing a website – I’ll try and avoid jargon but do feel free to mail me if you have any questions.