buffawhat.com

[Android SDK] DDMS broken in Snow leopard? Lets fix it.

09.02.2009 @ 12:47 PM in Technology

android_icon_512

While the Android SDK may be a stellar tool for developers, its also holds a very useful tool for bloggers: the screen shot utility found in DDMS. If you recently upgraded your Mac to Snow Leopard, you may have noticed that DDMS no longer works , instead terminal outputs something like this:

11:17 E/ddms: shutting down due to uncaught exception
11:17 E/ddms: java.lang.UnsatisfiedLinkError: /tools/lib/
libswt-pi-carbon-3236.jnilib:  no suitable image found.  Did find:
/tools/lib/libswt-pi-carbon-3236.jnilib: no matching
architecture in universal wrapper
        at java.lang.ClassLoader$NativeLibrary.load(Native Method)
        at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1878)
        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1771)
        at java.lang.Runtime.loadLibrary0(Runtime.java:823)
        at java.lang.System.loadLibrary(System.java:1045)
        at org.eclipse.swt.internal.Library.loadLibrary(Library.java:123)
        at org.eclipse.swt.internal.carbon.OS.(OS.java:20)
        at org.eclipse.swt.widgets.Display.createDisplay(Display.java:943)
        at org.eclipse.swt.widgets.Display.create(Display.java:923)
        at org.eclipse.swt.graphics.Device.(Device.java:118)
        at org.eclipse.swt.widgets.Display.(Display.java:754)
        at org.eclipse.swt.widgets.Display.(Display.java:745)
        at com.android.ddms.UIThread.runUI(UIThread.java:330)
        at com.android.ddms.Main.main(Main.java:97)

I’m no java expert, but a quick Google search exposes the problem and reveals a solution:

The SWT library uses a native component that must be loaded by the VM.
At this time we only provide the 32bit version.
I’m guessing that in Snow Leopard the default VM is now 64 bit instead
of 32 bit.

To change this go in Applications folder, then Utilities, and launch
the “Java Preferences” app. You’ll be able to set a 32 bit VM as the
default one.

Eclipse 3.5 added support for 64bit SWT on MacOS, so we’ll migrate to
this to support 32/64 bit on MacOS.

Xav

Screen shot 2009-09-02 at 12.28.02 PM

If that still doesn’t do it, you’ll need to open up DDMS in textEdit and head to this line:

# Mac OS X needs an additional arg, or you get an "illegal thread"
complaint.
if [ `uname` = "Darwin" ]; then
    os_opts="-XstartOnFirstThread"

And add “-d32″ where shown:

# Mac OS X needs an additional arg, or you get an "illegal thread"
complaint.
if [ `uname` = "Darwin" ]; then
    os_opts="-XstartOnFirstThread -d32"

Done. you should be able to run DDMS and take screenshots to your blogging heart’s content.

Thanks to Foo and Xav for their help in that thread.

  • 4 Comments