Easy Android SDK installation for CI servers
Install the gem:
gem install android-sdk-installer The installer looks for a android-sdk-installer.yml file in order to configure where the artifacts are and where they should go. For example:
platform: linux components: - build-tools;25.0.3 - platforms;android-25 - extras;android;m2repository # support libs - extras;google;m2repository # google play services libAfter creating this configuration, all you need to do is run:
android-sdk-installerIf you run android-sdk-installer with no android-sdk-installer.yml present, the sdkmanager will be installed.
Version is the SDK Tools version, defaulting to 26.0.2 (3859397). The latest version number can be found at the bottom of the page here as a part of the download URL.
Currently supported platforms are linux and darwin (macosx). windows is not supported. Defaults to linux. Assumes that unzip is available (may require install).
The components are defined by the sdkmanager command line tool. You can get a list of available components by running:
sdkmanager --liston a machine with the Android SDK installed.
Additional configuration can be added to android-sdk-installer.yml. The following is a complete example with all possible values:
platform: linux # the platform version: 3859397 # the version debug: true # more logs ignore_existing: true # command line tools will not install if ANDROID_HOME is found. Forces installation components: # list of the components to install - build-tools;25.0.3If no android-sdk-installer.yml file is found, the default command line tools will be installed (for linux)
In addition to configuration within android-sdk-installer.yml, some configuration can be done via command line arguments. To see a list of the options, run android-sdk-installer -h
Usage with Travis can be a little odd due to the fact that ANDROID_HOME needs to be set before install. Here is an example configuration:
language: java env: - ANDROID_HOME=$PWD/android-sdk jdk: - oraclejdk8 before_install: - rvm install 2.3.4 - gem install android-sdk-installer - android-sdk-installer -i script: "./gradlew build"Just run ruby test/test.rb. Set up your android-sdk-installer.yml as desired.
- Adjust the version in the gemspec
gem build android-sdk-installer.gemspecgem push android-sdk-installer-version.number.here.gem- Tag release in git
This tool will automatically accept licenses for the Android SDK, and will add files indicating that you have accepted the Android SDK licenses. Please read and understand these licenses before using this tool and assure you agree with the terms.
Thanks to the following for being a great reference on how to create a command line Ruby Gem:
android-sdk-installer is available under the MIT license. See the LICENSE file for more info.