2014/08/04

Configure android build environment on remote host


Often it's needed to configure CI build server for android development process. There is no problem with that if you have physical access to machine. But what if only SSH access is allowed and you are not able to run programs with UI?

Below is short instructions how to install and configure required software using command line only.

Well, my CI server is based on Ubuntu linux, so all code examples present in this article is correct for ubuntu-like operation systems. But I'm sure it won't be a real problem for you to find similar commands for your OS.


x64


First, make sure you've installed 32bit libraries in case of 64bit version of OS. You can get them using next command.

sudo apt-get install ia32-libs


Java


Next, install Java Development Kit 6. I recommend to use Oracle JDK, but OpenJDK will be suitable too. To install Oracle JDK follow next few steps.
  • Download JDK from Oracle official downloads page.
  • Extract JDK and set environment variable JAVA_HOME. It has to point to extracted JDK root folder
  • Add $JAVA_HOME/bin folder to you PATH variable
Please, see java.com help page if something went wrong.


Android SDK


Since we are going to use android development tools for CI server only, we don't need to install Eclipse ADT or Android Studio. Standalone Android SDK will be enough.
  • Download Android SDK from http://developer.android.com/sdk and unpack it.
  • Set environment variable ANDROID_HOME. It has to point to extracted SDK root folder.
Android SDK contains separate packages for tools, platforms and other components. These components have to be downloaded additionally. There are instructions about installing SDK packages using Android SDK Manager. But, it's impossible to install packages in terminal following this manual. That's because of SDK Manager are used in GUI mode.

Fortunately, there is some undocumented way use SDK Manager in non-graphic mode. I wrote 'undocumented', because I couldn't find any information about it at tools help page.
So, let's go.

  • Change current directory to Android SDK root folder. Next, go into tools dir.

  • cd $ANDROID_HOME; cd tools

  • Check SDK packages available to install. Please, pay attention on --no-ui key. This command line argument allows us to run SDK Manager in non-GUI mode. Output of this command is list of SDK components available for installation.

  • ./android list sdk --no-ui

  • Install packages you need. The --filter key is used to specify packages operation to be performed with. Use number of package from previous command output.

  • ./android update sdk --no-ui --filter 1,2,3

The Android SDK allows us to get up-to-date version in bounds of major version; to get next major version it’s need to update sdk again.

---
I hope this post will be helpful.

4 comments:

  1. Good Post, I am a big believer in posting comments on sites to let the blog writers know that they ve added something advantageous to the world wide web.
    python interview questions and answers | python tutorials

    ReplyDelete
  2. Thanks for the good words! Really appreciated. Great post. I’ve been commenting a lot on a few blogs recently, but I hadn’t thought about my approach until you brought it up. 
    Devops training in sholinganallur
    Devops training in velachery
    Devops training in annanagar
    Devops training in tambaram

    ReplyDelete
  3. Thank you for allowing me to read it, welcome to the next in a recent article. And thanks for sharing the nice article, keep posting or updating news article.

    Data Science course in kalyan nagar | Data Science course in OMR

    Data Science course in chennai | Data science course in velachery

    Data science course in jaya nagar | Data science training in tambaram

    ReplyDelete
  4. I have picked cheery a lot of useful clothes outdated of this amazing blog. I’d love to return greater than and over again. Thanks! 

    devops online training

    aws online training

    data science with python online training

    data science online training

    rpa online training

    ReplyDelete