action-android
action-android copied to clipboard
Impossible to install older command-line tools, always `latest` is downloaded
I need to install Command-Line Tools v8, the last version comaptible with Java 8.
I found the right URL, but even when I pass it, I still get command-line tools latest, which require JDK17:
- name: Set up Android SDK
uses: malinskiy/action-android/install-sdk@release/0.1.7
with:
url: https://dl.google.com/android/repository/commandlinetools-linux-9123335_latest.zip
# Above URL points to Command Line Tools v8.0 - the last version compatible with Java 8
# Found via https://stackoverflow.com/a/75763391/7009800
# Another useful website: https://androidsdkmanager.azurewebsites.net/cmdline-tools.html
see workflow run: https://github.com/mobile-dev-inc/maestro/actions/runs/10221637495/job/28284879896?pr=1837
Pretty sure the sdk auto-updates itself, so even if you install an old version - it would automatically install current latest one. I can only see one solution so far - make self-update optional, but I'm not sure everything will function as expected.
You probably already know, but just in case - Java 8 reached end-of-life in 2022.
Disabling auto update sounds like a good escape hatch.
As for JDK 8 being EOL - I'm aware of it, unfortunately our product has it as min supported version so there's that. I need to make sure our CLI works fine on it.
Is it possible for you to submit a fix? Happy to review, merge and release.
I wish I had time to do that... :-(
Thanks again for building and open-sourcing this action.
I think it's a bit easier to specify the version of cmdline-tools:
cmdline-tools;1.0 | 1.0 | Android SDK Command-line Tools
cmdline-tools;10.0 | 10.0 | Android SDK Command-line Tools
cmdline-tools;11.0 | 11.0 | Android SDK Command-line Tools
cmdline-tools;12.0 | 12.0 | Android SDK Command-line Tools
cmdline-tools;13.0 | 13.0 | Android SDK Command-line Tools
cmdline-tools;2.1 | 2.1 | Android SDK Command-line Tools
cmdline-tools;3.0 | 3.0 | Android SDK Command-line Tools
cmdline-tools;4.0 | 4.0 | Android SDK Command-line Tools
cmdline-tools;5.0 | 5.0 | Android SDK Command-line Tools
cmdline-tools;6.0 | 6.0 | Android SDK Command-line Tools
cmdline-tools;7.0 | 7.0 | Android SDK Command-line Tools
cmdline-tools;8.0 | 8.0 | Android SDK Command-line Tools
cmdline-tools;9.0 | 9.0 | Android SDK Command-line Tools
cmdline-tools;latest | 13.0 | Android SDK Command-line Tools (latest)
Reason being is emulator action depends on SDK install and requires cmdline-tools package installed, so the action autoinstalls this as part of installation of emulator dependencies.
I took a quick pass at it in #87, would be awesome if you could take a look
You can use it from release branch release/cmdlinetoolsversion:
- uses: malinskiy/action-android/install-sdk@release/cmdlinetoolsversion
with:
cmdlineToolsVersion: 13.0
and the same thing with the emulator in case you need that one. I didn't test it, would appreciate your help there. You need to figure out which version of cmdline-tools is compatible with JRE8 though.
As a sidenote: let me know if you want to help with https://github.com/MarathonLabs/marathon/issues/855 at some point in the future since you might have the power to help there.
Thanks a ton, I will try it out. There's quite a lot of changes in #87 so I didn't look at it closely.
You need to figure out which version of cmdline-tools is compatible with JRE8 though.
Per my research here, v8.0 of cmdline-tools is the latest one that supports Java 8. For Linux, it can be downloaded from:
https://dl.google.com/android/repository/commandlinetools-linux-9123335_latest.zip
As a sidenote: let me know if you want to help with https://github.com/MarathonLabs/marathon/issues/855 at some point in the future since you might have the power to help there.
This is currently not on our roadmap and we don't have resources. I'll keep that in mind though!
@Malinskiy I tested your branch and it failed with the following error
Also, why additional cmdlineToolsVersion arg instead of making the URL work? I'm sure there's a valid reason and it's probably obvious, but the PR has many unrelated changes so I didn't read them all.
In the end I decided to manually download Android SDK and create AVD. If anyone's curious, here's the code:
https://github.com/mobile-dev-inc/maestro/blob/9cd39a64a08fcc25753d436c2108bfa811b156dd/.github/workflows/test-e2e.yaml#L88-L137