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

1

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

已提問 4 年前檢視次數 397 次
9 個答案
1

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 https://docs.aws.amazon.com/devicefarm/latest/developerguide/custom-test-environments.html), 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 "https://aws-devicefarm-support.s3-us-west-2.amazonaws.com/new_build_tools.zip" -o /tmp/new_build_tools.zip
      - unzip /tmp/new_build_tools.zip -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.

Thanks,
Jon

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

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

AWS
已回答 4 年前
  • Hi, I'm wondering how it's possible to update adb without killing the existing adb server.

    Running adb kill-server in install phase gives me this output: adb kill-server is not permitted. If I don't kill, then running adb devices after downloading new adb gives me:

    adb server version (39) doesn't match this client (41); killing...
    ADB server didn't ACK
    Full server startup log: /tmp/adb.1019.log
    Server had pid: 2591
    --- adb starting (pid 2591) ---
    adb I 01-02 18:12:22  2591  2591 main.cpp:63] Android Debug Bridge version 1.0.41
    adb I 01-02 18:12:22  2591  2591 main.cpp:63] Version 33.0.3-8952118
    adb I 01-02 18:12:22  2591  2591 main.cpp:63] Installed as /home/device-farm/android-sdk-linux-new/platform-tools/adb
    adb I 01-02 18:12:22  2591  2591 main.cpp:63] 
    adb F 01-02 18:12:22  2591  2591 main.cpp:167] could not install *smartsocket* listener: Address already in use
    

    Please suggest - how do I proceed here?

1

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: https://aws-devicefarm-support.s3-us-west-2.amazonaws.com/new_build_tools.zip)

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

Thanks !

Andre
已回答 2 年前
0

Hey,

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 - https://forums.aws.amazon.com/message.jspa?messageID=942262#942262. 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?

已回答 4 年前
0

Hi,

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.

Thanks

sktdf
已回答 4 年前
0

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 :)

已回答 4 年前
0

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?

TIA!

kpj
已回答 3 年前
0

I am seeing chrome not reachable exception while switching context .chromedriver & chrome version seems to be in correct in the exceution run
https://us-west-2.console.aws.amazon.com/devicefarm/home?region=us-east-2#/projects/310b1ec6-ea89-4644-98f6-f3142813344a/runs/c8eee84e-546b-4016-8a80-c6624c6bb796/jobs/00001

can anybody help

ngupta
已回答 3 年前
0

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.

Thanks,
jon

AWS
已回答 3 年前
0

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:

[code]
- chrome_web_version=$(adb shell dumpsys package com.android.chrome | grep versionName | cut -d"=" -f2|sort |tail -n 1)
- >-
if [ $(echo $chrome_web_version | cut -d"." -f 1) -ge 70 ];
then
proper_chromedriver_version=$(curl -L https://chromedriver.storage.googleapis.com/LATEST_RELEASE_$(python -c "import sys;print(".".join(sys.argv[-1].strip().split(".")[:-1]))" $chrome_web_version) 2> /dev/null )
curl -L "https://chromedriver.storage.googleapis.com/$proper_chromedriver_version/chromedriver_linux64.zip" -o /tmp/chromedriver_linux64_new.zip 2> /dev/null;
unzip /tmp/chromedriver_linux64_new.zip -d /tmp >/dev/null;
mv /tmp/chromedriver $(echo "$DEVICEFARM_CHROMEDRIVER_EXECUTABLE"-orig);
rm -rf $DEVICEFARM_CHROMEDRIVER_EXECUTABLE;
cp $DEVICEFARM_TEST_PACKAGE_PATH/chromedriver-new-wrapper* $DEVICEFARM_CHROMEDRIVER_EXECUTABLE;
chmod +x $DEVICEFARM_CHROMEDRIVER_EXECUTABLE;
$DEVICEFARM_CHROMEDRIVER_EXECUTABLE -v;
else
echo "Defaulting to devicefarm chromedriver version";
fi;
[/code]

Let me know your thoughts,
Thank you,
Jon

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.

AWS
已回答 3 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南