Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Command line "Android update sdk" on headless Linux

Tags:

android

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.

like image 212
focuser Avatar asked Jan 28 '10 18:01

focuser


People also ask

How do I update Android SDK?

To open the SDK Manager from Android Studio, click Tools > SDK Manager or click SDK Manager in the toolbar. If you're not using Android Studio, you can download tools using the sdkmanager command-line tool. When an update is available for a package you already have, a dash appears in the check box next to the package.

How use Sdkmanager command line?

To use the SDK Manager to install a version of the command line tools, follow these steps: Download the latest "command line tools only" package from the Android Studio downloads page and unzip the package. Move the unzipped cmdline-tools directory into a new directory of your choice, such as android_sdk .


2 Answers

You can use the --no-ui option:

android update sdk --no-ui 

If you'd like to automate it, you could accept all licenses by using the expect tool with this hack (the --accept-license option is currently not fully integrated in the android tool):

expect -c ' set timeout -1; spawn android - update sdk --no-ui; expect {     "Do you accept the license" { exp_send "y\r" ; exp_continue }     eof } ' 
like image 114
x2on Avatar answered Oct 04 '22 07:10

x2on


Updating Android SDK headless and automatically is described in Stack Overflow question Is there a way to automate the Android SDK installation?.

like image 31
Diego Torres Milano Avatar answered Oct 04 '22 06:10

Diego Torres Milano