Too Many Bits for DDMS

If you’re like me, you do your Android development outside Eclipse and therefore rely upon the full range of the Android toolkit, from activitycreator through DDMS. And, if you’re like me, you just plopped a 64-bit Linux (Ubuntu 8.10 “Intrepid Ibex”) on a multi-core PC for development work.

Which means, if you’re like me, you ran into a problem trying to get DDMS to run.

DDMS appears to be written using the Eclipse’s SWT GUI toolkit. The version of the SWT that ships with Android 1.0r2 is written for a 32-bit Java runtime. If you try running it on a 64-bit Java VM, you get a nasty error like “wrong ELF class: ELFCLASS32 (Possible cause: architecture word width mismatch)” coming out of one of the RCP libraries (tools/lib/

I am sure there are any number of elegant ways to get around this that allow DDMS to run as 32-bit Java while the rest of your environment is 64-bit Java. However, I couldn’t find any. So, here’s a brute-force way to do it.

First, you need a 32-bit Java runtime. In Debian/Ubuntu, this is in the ia32-java-6-sun package. Install that using your favorite packaging tool (Synaptic, aptitude, apt-get, etc.).

You can then use update-java-alternatives –list to confirm that your 64-bit JDK is there, but the 32-bit JRE is also available. It should also have left alone your default Java (the one invoked when you run java at the command line).

Next, you need to teach DDMS to use the 32-bit Java instead of the default. Use update-java-alternatives –list to determine the path to your 32-bit Java runtime (e.g., /usr/lib/jvm/ia32-java-6-sun/bin/java). Then, make a copy of tools/ddms from your Android runtime and modify it, changing the value of java_cmd to match your 32-bit JRE location (e.g., java_cmd=”/usr/lib/jvm/ia32-java-6-sun/bin/java”).

Try it out, and DDMS should fire up just fine. Since it coordinates with devices and emulators using sockets or USB drivers, the fact that it is 32-bit does not affect its ability to interoperate with your other tools.

Of course, you have to remember to use your modified DDMS (e.g., set up a launcher for it on your desktop or a GNOME panel). And, you may need to repeat these steps, or ones like them, in future Android SDK releases, until DDMS is shipped in a way that works out of the box for both 32-bit and 64-bit Java.

Have a cleaner way to fix this problem? Post a comment and let us know!

About author

AndroidGuys 4627 posts

Founded on November 5, 2007, we've enjoyed bringing you the latest in Android news and rumors. Updated daily, we strive to deliver reviews, opinions, and updates on all things related to Android.

You might also like

News and Rumors

Sprint Awards $250,000 in 4G App Challenge

Sprint just doled out $50,000 to five different Android developers as part of the 4G App Challenge.  Designed to build momentum around their growing 4G network, Sprint and a few

News and Rumors

NVIDIA announces Tegra Note for October

NVIDIA has officially introduced its Tegra 4-powered reference tablet platform, pulling back the curtain on the Tegra Note. Priced as low as $199, the reference design will lead to new

News and Rumors

Android Hides in Army of “Good Guys” in Swiss iPad App Advertisement

We received a pair of tips this morning about an advertisement for the Swiss Broadcasting Corporation’s iPad application. Now, we don’t have any idea what those guys do over there, but we get the sense they are the NPR of Switzerland (Correct us if you know better). Watch the short video below and you’ll see their version of the history of Switzerland, acted out with cute little cartoon-y characters. The clip, designed to help pitch their iPad app, has an awesome easter egg.