Skip to main content

A command-line utility for keeping your Android dependencies up-to-date.

Project description

A tool for keeping your Android SDK dependencies up-to-date in unattended environments. Pass it your $ANDROID_HOME and let it update your installed SDK packages as new revisions are released. Optionally, provide a list of package names (from android list sdk --all --extended) to bootstrap your environment, or to ensure your latest set of dependencies are installed for your next CI run.

This tool is especially useful for continuous-integration servers.

Why do I need this?

The command-line tools provided by the SDK are not especially useful for unattended use. Among other problems:

  • There is no built-in method to list packages that are already installed. This may be because there is no easily-consumed index of installed packages provided, so the SDK manager relies on directory scanning and name-mangling. So does this tool, by the way.

  • Some packages are unnecessarily downloaded and re-installed with no rhyme or reason when the latest version is already installed.

  • Some packages are not automatically updated when an incremental update is available.

  • The package installer requires input from STDIN to actually install packages, because it assumes a human is present to accept software licenses.

This tool performs all of the gritty scanning, mangling, parsing, and input-faking necessary to determine:

  • Packages you have installed, and their revisions.

  • Packages that are available from the official update sites, and their revisions.

  • Local packages which should be updated due to an available revision-bump.

  • Which packages were actually installed, and which failed to install, after the installer has run.

The ultimate goal of this project is to cease its existence when the Android Tools team addresses these pain points. These are mostly solved problems in the GUI tool, but they make unattended builds a hassle.

Disclaimer

By using this tool you acknowledge that associated licenses of the components downloaded are accepted automatically on your behalf. You are required to have accepted the respective licenses of these components prior to using this tool.

Requirements

Tested with Python versions 2.7 and 3.5.

Dependencies:

  • jprops

  • pexpect

  • semantic_version

Installing

Using pip:

$ pip install android-sdk-updater

From source:

$ git clone https://github.com/tadfisher/android-sdk-updater.git
$ cd android-sdk-updater
$ python setup.py install

For development:

$ python setup.py develop

Usage

usage: android-sdk-updater [-h] [-v] [-a ANDROID_HOME] [-d] [-t TIMEOUT] [-vv]
                           [-o ...] [-s {available,installed,updates}]
                           [package [package ...]]

Update an Android SDK installation

positional arguments:
  package               name of SDK package to install if not already
                        installed

optional arguments:
  -h, --help            show this help message and exit
  -v, --version         show program's version number and exit
  -a ANDROID_HOME, --android-home ANDROID_HOME
                        the path to your Android SDK
  -d, --dry-run         compute packages to install but do not install
                        anything
  -t TIMEOUT, --timeout TIMEOUT
                        timeout in seconds for package installation, or 0 to
                        wait indefinitely (default)
  -vv, --verbose        show extra output from android tools
  -o ..., --options ...
                        options to pass to the "android" tool; must be the
                        final option specified
  -s {available,installed,updates}, --show {available,installed,updates}
                        Show available or installed packages

Additional whitespace-delimited package arguments can be piped to this tool over the standard input.

Examples

Perform an incremental update of all packages in $ANDROID_HOME:

$ android-sdk-updater

Perform an incremental update of all packages in /foo/sdk:

$ android-sdk-updater --android-home=/foo/sdk

Update all packages in $ANDROID_HOME and ensure the installation of packages android-23 and extra-google-google_play_services:

$ android-sdk-updater android-23 extra-google-google_play_services

Update all packages in ANDROID_HOME and ensure the installation of packages contained in a file:

$ cat packages.txt
tools
platform-tools
build-tools-23.0.2
android-23
addon-google_apis-google-23
extra-android-m2repository
extra-google-m2repository
extra-android-support
extra-google-google_play_services
sys-img-x86_64-addon-google_apis-google-23

$ cat packages.txt | android-sdk-updater

Same as the above, but through a proxy:

$ cat packages.txt | android-sdk-updater -o --no-https --proxy-host example.com --proxy-port 3218

Show installed packages, available packags, or packages with updates:

$ android-sdk-updater -s installed

$ android-sdk-updater -s available

$ android-sdk-updater -s updates

Caveats

The Android NDK is not supported. We plan to support installing and updating the NDK in a future release. In the meantime, you may see output that includes the following:

Ignoring 'ndk-bundle' as it is blacklisted.

These warnings may be safely ignored.

License

Copyright 2016 Tad Fisher
Copyright 2016 Tristan Waddington

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

android-sdk-updater-1.0.1.tar.gz (9.3 kB view details)

Uploaded Source

Built Distribution

android_sdk_updater-1.0.1-py2.py3-none-any.whl (13.5 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file android-sdk-updater-1.0.1.tar.gz.

File metadata

File hashes

Hashes for android-sdk-updater-1.0.1.tar.gz
Algorithm Hash digest
SHA256 e6452886a11642828b8e22f4e2aac04e6cf70485c94136b8968e33842bc03914
MD5 9f536b823808402b20e02b1f68728c57
BLAKE2b-256 702f7bdc0b67030536125af00df57f6e4681ccd1b143604772809585d5e22ea5

See more details on using hashes here.

File details

Details for the file android_sdk_updater-1.0.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for android_sdk_updater-1.0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 1921dfcfe4b3011484475de4034fc0c2be64718b6d0933a998efc61ab75491b2
MD5 e50a57e6003cc6d3d91db1d0fe7bb974
BLAKE2b-256 0b62a0ad2a6efb77ae1ecd204bf9ab6fa8adf106b433cd0bd690a7f75abb0b63

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page