Nov 9, 2009

Problems running Android SDK on a Mac

You might encounter a problem when trying to install and run the Android SDK on your Mac like me yesterday. The symptom is like when you're trying to run the "android" command line tool, it says the following text and then does nothing:

dll-book:~ dll$ android Developer/android-sdk-mac/tools/android 
Starting Android SDK and AVD Manager
No command line parameters provided, launching UI.
See 'android --help' for operations from the command line.

The solution is simple - "android" is a shell script which contains a hardcoded path to a Java 1.5 executable. However, due to bug in SWT, it does not run under OS X 64 bit JDK 1.5 and since android's UI is SWT based, it does not run either.

To solve the problem, simply open the "android" executable in any text editor (it is a simple shell script), then find and replace the path to 1.5 JDK to a path to 1.6 one. It is easy to perform a search for the phrase "java_cmd" in your text editor and you'll find it. Once 1.5 changed to 1.6, everything works just fine.