Wednesday, March 27, 2013

The 4.2.2 Update

Ah, the joys of Android development!

Yesterday I received the over-the-air update to my Samsung Galaxy Nexus to version 4.2.2. The update broke compatibility with the custom app I wrote to track my online sales. I didn't figure it was that big a deal. I'd just fire up Eclipse, investigate the error and fix it.

But hm...suddenly the Android Debug Bridge (ADB), the software that lets my Android device talk to my PC development environment, wasn't recognizing my device. First things first, I went to check my developer options on the phone to make sure that USB Debugging was enabled. developer options. That seemed really strange. After a bit of Googling, I found out how to enable developer options on this version of Android. You open up Settings, scroll to About Phone, and click it 7 times. Yes, that's right...I'm not joking. Google put the dev options in an Easter egg format. This is cute, but from a usability standard it's downright stupid. You shouldn't outright hide such options. If they're worried a hapless end user is accidentally going to enable an option that puts their phone at greater risk for malware, the sensible thing to do is to use warning dialogs. You know, like "Are you sure you want to enable this feature? Doing so could be really bad for you if you don't know what you're doing." If a naive user continues past this point, they deserve what they get. But hiding the option altogether is just silly.

Anyway, I enabled the dev options, made sure USB Debugging was enabled, and plugged the phone into my PC (which is running Windows 7 x64, by the way). It worked, right? Nope. Drivers were being installed upon connection, but I was getting a new warning: "Hardware ID missing. Windows cannot identify the device plugged into Samsung USB Composite Device." Hm...okay.

An hour of research later, I find a forum post that suggests upgrading the Android SDK tools, including the ADB. Sounds sensible. However, it takes me a while to figure out that I don't actually have the latest versions of the appropriate platform tools because the Android SDK Manager is showing that older versions are actually the most recent, and is not prompting me to update. Well that's cool. So back to the forums, and another dev reports the same issue, and suggests manually downloading the tools. So I do that, and finally, after rebooting my PC and phone for what seems like the 100th time, I finally get the prompt on my phone that looks something like this:

You see, in Android 4.2.2 Google added a new security feature to USB debugging, so you can't establish a connection between your phone and PC without first getting this prompt and clicking OK. Finally that did it. I fixed the problem with my app and ran it.

Total time to get my phone talking to my computer after the update: the whole day. Awesome...thanks Google!