Command line "Android update sdk" on headless Linux

Viewed 56428

How can I update/install the Android SDK platforms on a headless Linux server?

All I got was the following error:

It seems like the action "update sdk" is actually not supported.

~/android-sdk-linux_86/tools$ ./android --verbose update sdk
No command line parameters provided, launching UI.
See 'android --help' for operations from the command line.
Exception in thread "main" java.lang.UnsatisfiedLinkError: no swt-pi-gtk-3550 or swt-pi-gtk in swt.library.path, java.library.path or the jar file
        at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source)
        at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source)
        at org.eclipse.swt.internal.gtk.OS.<clinit>(Unknown Source)
        at org.eclipse.swt.internal.Converter.wcsToMbcs(Unknown Source)
        at org.eclipse.swt.internal.Converter.wcsToMbcs(Unknown Source)
        at org.eclipse.swt.widgets.Display.<clinit>(Unknown Source)
        at com.android.sdkuilib.internal.repository.UpdaterWindowImpl.open(UpdaterWindowImpl.java:93)
        at com.android.sdkuilib.repository.UpdaterWindow.open(UpdaterWindow.java:110)
        at com.android.sdkmanager.Main.showMainWindow(Main.java:281)
        at com.android.sdkmanager.Main.doAction(Main.java:251)
        at com.android.sdkmanager.Main.run(Main.java:92)
        at com.android.sdkmanager.Main.main(Main.java:81)

The question was asked when headless update wasn't supported. As of 2012, it is now possible to do just a android update sdk --no-ui.

6 Answers

Yes, it works but you need the GUI libraries installed and you need your DISPLAY environment variable set to what X server you want it to display.

I have it working now on CentOS 5.4 and had to use the "Server - GUI" verse "Server" install option. Then I just use "ssh -X" from the system where I want it to display.

I had to analyze it using strace -f -v -s1024 -o/tmp/android.log ./android. I found the needed libs were being automatically created, and found, under /tmp/swtlib-64/. However, I still got the above error. Digging further into /tmp/android.log, I found libgtk-x11-2.0.so.0 was not found. So after sudo apt install libgtk2.0-0, I could run the android installer graphically using ssh -X to the headless server.

Related