Search code examples
androidsdkubuntu-14.04headless

android update sdk --no-ui:making it selective


I am in the process of setting up a headless Ubuntu server to experiment with Crosswalk. My first attempt was on a virtual server with 15Gb of disk space. It came a cropper because I ran out of disk space during the android update sdk --no-ui step. I was slightly taken aback at this but I decided to try again with a server with 20Gb of disk space. Much to my surprise it consumed all of the 20Gb and gave up.

Clearly, this is not a viable route forward. I could in principle get a VM with, say, a 100Gb disk but I would end up paying for something I don't need. I observed what was happening during the install more carefully during my second attempt. The android update sdk command gets a whole load of SDK APIs and the corresponding documentation all the way down to the distant Android Version 1 days.

I have no interest whatsoever in being able to compile APKs for anything lower than, say, Android 4.x. I have checked the docs but been unable to find any mechanism for instructing android update sdk to be more specific in what it downloads.

The closest I have come to finding something useful is

android update sdk --no-ui --filter android-XX > /dev/null

which I suspect sends the android-XX version to /dev/null oblivion. However, it is not clear to me how/whether I can filter out everything less than, say, android-43.

I suspect this is possible but I am not sure how to go about it.


Solution

  • I figured this out on my own eventually so I thought I would share it here for the benefit of anyone running into this thread.

    The right way to do this to selectively install specified versions of the API is

    android update sdk --no-ui --filter platform-tools,android-XX,android-YY...
    

    where android-XX, android-YY are the versions of the API you want to have installed. You can establish the relevant numbers from the Android Documentation.