Android Studio Debugging with Nexus 4 Google Driver

Recently I’ve been thinking of dipping my toe back into the world of Android app development and discovered that there is a new IDE on the block in the form of the Android Studio.

I installed this on my (Windows) machine, which isn’t a speed demon by any stretch of the imagination, and tried to run a “Hello World!” program on the emulator but it was taking 10 minutes for the emulator to start and it was still just showing the android boot screen, so I decided to try it out on my Nexus 4.

I followed the standard advised steps, enabling USB debugging and setting the USB mode to PTP, but the phone didn’t appear when I connected it and went to Run the package from Android Studio.  Further, the drivers wouldn’t install properly.  Advice seemed to be to go to Device Manager and install from <sdk>\extras\google\usb_driver\ – but there was no usb_driver folder there.  However you can  install this from the “SDK Manager” from the Android Studio toolbar.

Screenshot of Android Studio toolbar highlighting SDK Manager button
SDK Manager button on Android Studio toolbar

This will open the SDK Manager which seems to contain optional components that you can install alongside the Android Studio.  In this case I was looking for the Google USB Driver which is listed under “Extras”.

Continue reading “Android Studio Debugging with Nexus 4 Google Driver”

Take a Screenshot on your HTC Desire S / Evo 3D

I know you can take screenshots with Android 4.0/Ice Cream Sandwich, but I discovered a week or so back that, having upgraded my HTC Desire S to HTC Sense 3.0 (on Android 2.3.5) I can now do this without an ICS upgrade!

Here it is from the horse’s mouth: it seems all you have to do to take a screenshot on your HTC device is hold the power button and press the home button. Your screenshot will be captured and saved to your gallery.

I actually took my first screenshot on my Desire S following the upgrade to HTC Sense 3.0 by accident!! I was on a website in the browser and pressed something that made a message come up “Screenshot saved to Gallery”. What!? Screenshot?

Yes, it turns out you can take a screenshot on HTC Sense 3.0 (and presumably HTC Sense 3.5). I have since got myself an HTC Evo 3D (which comes with Sense 3.0) and verified that the same process works there, the only difference is that it saves to “Camera Shots”.

Much thanks to Andrew Girdwood, whose post  “How do you take a screen shot with your HTC Sensation” I came across on a Google search as his comments section was where I first discovered the answer.

Android/Facebook/Eclipse – Must Override a Superclass Method

I’m trying to get into developing apps for Android and developing an Android Facebook app seemed like an good place to start with something useful.  However it seems frought with problems that will perplex the beginner.

One early problem I encountered which had a non-0bvious solution was the message:

The method onCancel() of type new Facebook.DialogListener(){} must override a superclass method

This occurred after pasting some example code from the Facebook site into my project.  The problem?  My project was defaulting to JDK 1.5 and the code on the Facebook site requires 1.6!

It’s been a while since I looked at Java but the problem is apparently due to the use of the “@override” syntax. According to one helpful StackOverflow member, in Java 1.6 this can also be used to implement interface methods, but in 1.5 could only be used to override superclass methods.

Eclipse/Android Development Installation Issue

Yes, it’s Christmas as I blog this at 2am, however I got a new laptop for Christmas and am geeking it out to the point where I can use it for fun stuff.  To that end I’ve been trying to install the requisite tools for Android development and hit an issue which could have (but thankfully didn’t) take me hours to sort out.  I’m a complete n00b at this, so don’t treat this as anything like a complete guide!

Having managed to “install” Eclipse (which from what I can tell just means copying the contents of a zip file to somewhere on your hard drive) and the Android SDK, I needed to install the ADT (Android Development Tools) plugin for Eclipse.  However on doing this I was getting an error telling me:

Missing requirement: Android Development Toolkit 0.9.4.v200910220141-17704 ( 0.9.4.v200910220141-17704) requires ‘bundle org.eclipse.gef 0.0.0’ but it could not be found

This was a pain, and it took a bit of Googling to discover how to rectify that. Apparently the version of Eclipse Google recommend (Classic) doesn’t include the GEF or ‘Graphical Editing Framework’ which the Android ADT plugin requires.  Nice!  So the easy way to install this (thank you to IBM for the pointer on this) is to install it the same way you would the ADT plugin, i.e. open up Eclipse and choose “Install New Software” in the “Help” menu.

When it says work with, instead of using the URL Google give for Android, use the one where GEF lives.  In my case, for version 3.6.x of Eclipse, this is:

Helios –

(Helios being the codename for Eclipse 3.6).  Once this is done you’ll be advised to restart Eclipse (so I did) and everything seems to be going ok now (touch wood!).

I just hope this helps someone else with the same problem or, more importantly, helps me the next time I come across the same thing and end up scratching my head trying to remember how I fixed it!

HTC Desire Headphone Issues

This is just a random puzzling issue. I recently went to work without my iPod headphones which I’ve been using with my HTC Desire to listen to music during work, so I tried some others I’d picked up over the summer courtesy of Continental Airlines.

For some reason when I put the headphones in the sound went all echoy and when I tried to fix it the tracks would randomly skip forwards, skip backwards and skip through tracks. I also noticed the headphones icon at the top included what looks to be a headset microphone.

Turns out I’m not the only one… users on Android Forums have been reporting the same issue. Very disappointing from a top-of-the-range Smartphone.