Repository navigation
Fix Ubuntu CI - #203
Fix Ubuntu CI#203dfabulich wants to merge 11 commits into
Conversation
This command will ensure that cmdline-tools is installed in `$ANDROID_HOME`, which will be `~/Library/Android/sdk` on macOS by default. This works with or without Android Studio installed, creating the directory if it doesn't exist yet. If cmdline-tools are not installed, we can "bootstrap" them by running _any_ `sdkmanager` we can find. Our Homebrew cask installs `android-commandlinetools`, which installs its own Android SDK (probably _not_ the one the user wants to use). We can use that to run `sdkmanager --sdk_root=$ANDROID_HOME "cmdline-tools;latest"` to install the command line tools into Android Studio's SDK; then we can use the cmdline-tools in `$ANDROID_HOME`.
1. We now use the new `ensureCmdlineTools` function from `skip android home install` 2. We ask `emulator` for the list of AVDs, skipping creating the AVD if it already exists. (Despite the claim of `--force`, in my experiments, I found that it wasn't able to overwrite an existing AVD, e.g. to change the system_image.) 3. If there's no existing emulator with that name, we can finally create the emulator with a known-good `avdmanager` in `ANDROID_HOME`'s `cmdline-tools`. Fixes skiptools#187
1. If the user passes no name, we use `emulator -list-avds` to list the AVDs 2. If there happens to be exactly one AVD, we launch that one. 3. If there aren't any AVDs, we fail with a clear error message that we couldn't detect any emulators, inviting the user to run `skip android emulator create`. 4. If there are multiple AVDs, but one of them happens to be the exact name of the emulator that would have been created by `skip android emulator create` if you pass _that_ no arguments, then we launch that one. 5. Otherwise, there are multiple AVDs, but none of them exactly match the name of the `skip android emulator create` AVD, and we just give a clear error message explaining that. Fixes skiptools#189 and skiptools#202
4759620 to
ef8b33c
Compare
ef8b33c to
bf2946d
Compare
7cbfa19 to
3277223
Compare
|
I think I've figured it out! https://github.com/skiptools/skipstone/actions/runs/22827276828/job/66210543724#step:17:1117 That's The problem is, the latest version of That feels like a bug in It seems like Google sanitizes this by adding environment variables like these: https://android.googlesource.com/platform/tools/base/+/mirror-goog-studio-main/bazel/avd/emulator_launcher.sh.template#109 I believe that will make That raises questions about how/where we want to use that information.
@marcprux Do you have any intuition on what would be best here? |
|
So It sounds like reactivecircus has contended with this ReactiveCircus/android-emulator-runner#197 (comment) and ReactiveCircus/android-emulator-runner#405. I'm not sure if their approach is correct, but I'm also not sure what is correct. But I think that it would be OK if we just replicate what they are doing. At this stage, we mostly just care about this command working well on CI (since I doubt any actual users are using Skip on Linux, at least until we can get app building working), so I don't mind not handling every conceivable user/environment variant (as opposed of macOS, where we do expect end users to be relying on these commands). So how about we have the launch command set the |
|
I'm going to be pretty busy this week, so I think for now I'm just going to add the necessary environment variables in PR #200. I've separately filed #204, which we could fix whenever we want. And, for now, I'm going to close out this PR (which was really just to diagnose the Ubuntu build failures). |
This PR is based on #200, attempting to fix Ubuntu CI.
Skip Pull Request Checklist:
swift test