Android Development

I’ve been using the Android SDK for a few months now to develop some silly little applications.  However, just yesterday, after updating to Android 2.2, I discovered the process had become a little hit and miss.  The phone would crash more than usual.  I even lost the SD card and it request I reformat it.  I took it out, rebooted the phone, turned it off again, put the SD card back, rebooted the phone and all seems to be well again.

Well tonight, the Eclipse IDE I’ve been using wouldn’t attach to the phone for debugging any more.  It would download the ‘apk’ to the phone and I could execute it manually but it wouldn’t connect the debugger.   In an attempt to figure out what was going on I updated Eclipse (HELP->Check for Updates), and my Android Plug-ins (SDK & AVD Manager).  This didn’t fix the problem but I now have lots of new Docs and the 2.2 SDK installed.  One problem I did have was that Eclipse locked the folder containing the Android SDK that was being used by my projects.  This meant it couldn’t update it.  So I closed Eclipse and deleted the folder by hand so that Eclipse could update it.  I guess unloaded the projects would have unlocked the folder too.

So why couldn’t I debug?  I discoved the DDMS which I hadn’t seen before.  This is pretty good for looking at the heap in realtime and taking snapshots and viewing the raw file structure of my phone’s OS!  But this only showed that I couldn’t connect to the phone to find any processes.  However, the phone was listed as a device.

Still none the wiser, I started to trundle around my user folders.  I saw the “.android” folder and took a peek inside.  Nothing made much sense so I thought; close Eclipse, delete (or rename) the files in this folder and start Eclipse again.  SUCCESS – Eclipse can now connect to my phone and I can see the processes on DDMS and I can debug my programs again.

I don’t know what happened but the the files I removed were ‘debug.keystore’, ‘ddms.cfg’, ‘androidtool.cfg’, ‘adb_usb.ini’.   The only one which was recreated by running Eclipse again was ‘ddms.cfg’.

Advertisements
%d bloggers like this: