Friday, July 10, 2009

DDMS on Ubuntu 64bit

The Android SDK comes with a pretty nice suite of tools, one of these is the Dalvik Debug Monitor Service (DDMS). However, it seems like the Android SDK is distributed with some 32bit SWT libraries so if you are on a 64bit Linux, running a 64bit Java default, you might run into this little message:

casper@workstation:/$ dbms
43:27 E/ddms: shutting down due to uncaught exception
43:27 E/ddms: java.lang.UnsatisfiedLinkError: /android-sdk-linux_x86-1.5_r2/tools/lib/ /android-sdk-linux_x86-1.5_r2/tools/lib/ wrong ELF class: ELFCLASS32 (Possible cause: architecture word width mismatch)
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(
at java.lang.ClassLoader.loadLibrary(
at java.lang.Runtime.loadLibrary0(
at java.lang.System.loadLibrary(
at org.eclipse.swt.internal.Library.loadLibrary(

This is fairly easy to fix, by first installing the 32bit version of the JRE:

casper@workstation:/$ sudo apt-get install ia32-sun-java6-bin

And then making sure DDMS is using this particular one. There are countless ways to do this (add new environment variables etc.) but I chose to simply modify DDMS itself, which seems like the least invasive way for this purpose. If you go to line 71, it should currently read:


It's obviously relying on the /usr/bin/java symlink which we have in path, which leads to /etc/alternatives/java which again leads to our default 64bit version of the JRE. So change the line to this instead:


Now DDMS should run so you can monitor, debug and take screenshots of your virtual or physical device.