December 22, 2014

How to Fix the Android SDK Debug Monitor in OS X Snow Leopard

android_sdk_osx2The Android SDK is probably my favorite tool to come out of the Android OS so far. I use it for everything- installing apps, emulator tests, moving files- I even use the Dalvik Device Monitor (ddms) to take screenshots and terminate apps. But when I upgraded to Snow Leopard earlier this month, I realized that the SDK tools weren’t working like they were before. As a matter of fact, they weren’t working at all.

If you open up any of the SDK tools in OS X 10.6, you’ll notice that they just output error logs and then quit. Luckily, there’s a fix for it that doesn’t involve going back to 10.5. If you open up Utilities in your Applications folder, you’ll see an app called Java Preferences. If you open that up, you’ll see a Java Applications section. If you drag the 32-bit preference to the top, the ddms should be up and running again. However, if not, you’ll have to open up the terminal file in TextEdit, or Textmate, or whatever word processor you choose, and find the following line;

if [ `uname` = “Darwin” ]; then
os_opts=”-XstartOnFirstThread”

Change that line to;

if [ `uname` = “Darwin” ]; then
os_opts=”-XstartOnFirstThread -d32″

And ddms should work again. Now that Snow Leopard has moved to native 64-bit support, applications with 32-bit frameworks have to be modified for it’s new architecture. I won’t bore you with the technical jargon, though.