Monday, October 07, 2013

Travis and Android

If you're looking to build your Android app on Travis CI, using SDK r22.3 and API 19 (Android 4.4), put this in configuration file .travis.yml :

language: java
  # install necessary x32-libs for Android SDK 
  - sudo apt-get update -qq
  - sudo apt-get install -qq libstdc++6:i386 lib32z1
# download the latest android sdk and unzip 
  - wget
  - tar -zxf android-sdk_r22.3-linux.tgz
  - export ANDROID_HOME=`pwd`/android-sdk-linux
  - export PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools
# only update the sdk for the tools and platform-tools and required api level # (run "android list sdk --extended" to get the full list) - echo "y" | android update sdk --filter tools,platform-tools,build-tools-19.0.0,android-19 --no-ui --force

Up to date version is here.

What it does (and why):
  • The Travis virtual machines are running 64 bit kernels, but the Android SDK needs 32 bit, so packages libstdc++6:i386 and lib32z1 are needed.
  • The Android SDK is not installed on the Travis instance, so you need to download and install it yourself.
  • Update the tools and platform-tools and API (here API 19) related packages.
  • There is no command line option to accept the license, so piping a "y" to the installer is necessary. Please note : if you have to accept multiple licences, this will not work.
Update (08Dec2013) : Only install required x32 packages, use names of SDK packages

Thanks to Levi Wilson and Ralf Kistner for inspiration to get it working.

No comments: