By using AWS re:Post, you agree to the Terms of Use

Device Farm uses android build-tools 21.1.1, how can I update to 28.0.3?


device farm test platform Appium Node JS uses android build-tools 21.1.1, can I customize this to use 28.0.3?

asked 2 years ago60 views
9 Answers

Hi pauliedoherty,
Device Farm's Android test host is configured today with an older version of build tools. It is possible to "bring your own" per se, and change the ANDROID_HOME location to the new upgraded tools that you've brought. The following code, added to a test spec file for custom environment mode (see, in the install phase of the test, will download and configure version 24.0.3 of build tools for you:

      # fix the android sdk build tools
      - mkdir -p /home/device-farm/android-sdk-linux/build-tools
      - ln -s /opt/dev/android-sdk-linux/add-ons /home/device-farm/android-sdk-linux/add-ons
      - ln -s /opt/dev/android-sdk-linux/platforms /home/device-farm/android-sdk-linux/platforms
      - ln -s /opt/dev/android-sdk-linux/platform-tools /home/device-farm/android-sdk-linux/platform-tools
      - ln -s /opt/dev/android-sdk-linux/temp /home/device-farm/android-sdk-linux/temp
      - ln -s /opt/dev/android-sdk-linux/tools /home/device-farm/android-sdk-linux/tools
      - curl -L "" -o /tmp/
      - unzip /tmp/ -d /home/device-farm/android-sdk-linux/build-tools
      - export ANDROID_HOME=/home/device-farm/android-sdk-linux

Can you give this code a try, and let me know if this version, 24.0.3, will work for you? Otherwise, I can look into precompiling a zip file for 28.0.3 and posting that here as well.


Edited by: JonS-AWS on May 5, 2020 11:02 AM

Edited by: JonS-AWS on May 5, 2020 11:03 AM

answered 2 years ago


Thank you so much for speedy solution.

I have 2 applications, one built with expo and one we build ourselves. This solution worked out of the box for our Expo application but are hitting an error with the our other app. I was hoping it would work for both ;) . I have left a comment on this thread regarding issue with other app - I do feel it's environment related because it there are no issues on my local. I will get more time to test and debug today.

Is there a plan to keep upgrading build-tools and appium version as releases are ongoing?

answered 2 years ago


I don't think of any reason why it should not have worked for both the cases. Let us know the issue you faced in case of the failure.
As for build-tools upgrade, we don't have any plans. However, we did upgrade the appium version recently.


answered 2 years ago

The second apps build config was set to a minimum sdk version of 24. Updating this to 21 did the trick. Thanks again for help on this. Both apps are now running :)

answered 2 years ago

Hi JonS-AWS,

This thread is nearly a year old at this point, but I've run into the same issue. The suggested test spec updates do still work, but I'm wondering how stable this will be. Was this just a one-off to solve the OP's original issue? Or is this the defacto standard method to upgrade Android build-tools? Will build-tools be upgraded on the standard Device Farm images in the future?

Before finding this thread, I tried unsuccessfully to use the sdkmanager in /opt/dev/android-sdk-linux/tools/bin to upgrade to the latest build-tools package in-place. Should that have worked? Is there a trick to make it work?


answered 2 years ago

I am seeing chrome not reachable exception while switching context .chromedriver & chrome version seems to be in correct in the exceution run

can anybody help

answered 2 years ago

Hey there,
I completely understand your sentiment and where you are coming from. I would say: use the workaround for now, and we will upgrade the default build tools in the future eventually making the workaround unnecessary.


answered a year ago

Hi there,
Thank you for reaching out.

Please use the following workaround:

  1. First, add the attached file to the root of your test package zip file.
  2. Then, add the following code to your test spec file’s install phase in order to fix the $DEVICEFARM_CHROMEDRIVER_EXECUTABLE:

- chrome_web_version=$(adb shell dumpsys package | grep versionName | cut -d"=" -f2|sort |tail -n 1)
- >-
if [ $(echo $chrome_web_version | cut -d"." -f 1) -ge 70 ];
proper_chromedriver_version=$(curl -L$(python -c "import sys;print(".".join(sys.argv[-1].strip().split(".")[:-1]))" $chrome_web_version) 2> /dev/null )
curl -L "$proper_chromedriver_version/" -o /tmp/ 2> /dev/null;
unzip /tmp/ -d /tmp >/dev/null;
mv /tmp/chromedriver $(echo "$DEVICEFARM_CHROMEDRIVER_EXECUTABLE"-orig);
echo "Defaulting to devicefarm chromedriver version";

Let me know your thoughts,
Thank you,

Note; there was a bug in the previous code so that it only worked for native and hybrid apps. This has now been fixed to work with web apps.

answered a year ago

Hey @simsjon, I was using the new build tools that you provided, but since a few days ago I started to get a 403 (Url:

Can you please provide the file again so I can upload to a private bucket ?

Thanks !

answered 8 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions