Sunday, July 05, 2009

Android SDK Traceview on a 64bit computer

The Traceview tool that comes with the Android SDK does not work on a 64 bits computer out of the box. The reason for this is that Traceview uses Eclipse as its GUI, which in turn uses SWT, the Simple Widgets Toolkit, as its GUI builder. SWT uses native windowing. The advantage is that it's lighter and your windows look better, the drawback is that you need to create different jar files to run your app on different platforms. That's why Eclipse has different downloads for linux, mac and other platforms, despite the fact that Eclipse is written in Java. I like SWT, I use it to build desktop apps.

The Android SDK contains SWT. I suppose SWT is not the only reason why the SDK has different downloads for linux, mac and windows. But as it does, these downloads contain the SWT version appropriate for the platform. There's no separate download for 64 bits, so the parts of the SDK that use SWT will not work on your 64 bits computer. I found that replacing the SWT files in the SDK tools directory will solve this problem.

First, go to www.eclipse.org/swt and download SWT.jar for linux 64bits. Make sure you get the 64 bits version. Then, go to the /tools/lib directory in your Android SDK dir. Replace the SWT.jar there by the file that you downloaded. There's four .so files in that directory. These have a number 3236 in the file name. Replace these files by the same files with the number 3448. You'll find these files in the SWT.jar. The numbers may differ in your SDK version or in the SWT download.

Now, traceview should work.

I have not tried this for windows, but I think the same procedure will work on a windows 64 bits computer. In stead of .so files you'll find .dll files with numbers, just follow the same procedure with those.

1 comment:

G Slag said...

Whoo hoo! Great post. I can confirm that this works for 64-bit windows, as well. Thanks a million!