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/libswt-pi-gtk-3236.so: /android-sdk-linux_x86-1.5_r2/tools/lib/libswt-pi-gtk-3236.so: wrong ELF class: ELFCLASS32 (Possible cause: architecture word width mismatch)
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1778)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1687)
at java.lang.Runtime.loadLibrary0(Runtime.java:823)
at java.lang.System.loadLibrary(System.java:1030)
at org.eclipse.swt.internal.Library.loadLibrary(Library.java:123)

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.


Popular posts from this blog

Oracle SQLDeveloper 4 on Debian/Ubuntu/Mint

Beware of SQLite and the Turkish Locale

Rejsekort Scanner