Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support running emulators when running in remote/container environments #3315

Closed
Delgan opened this issue May 2, 2021 · 10 comments
Closed
Labels
in flutter Relates to running Flutter apps in remote Relates to running the extension in a remote setting using VS Code's remote dev support is enhancement
Milestone

Comments

@Delgan
Copy link
Contributor

Delgan commented May 2, 2021

Describe the bug
Hi!
I'm using the Remote - Containers extension with the Flutter' one on Linux. I can successfully configure Flutter, create an emulator, launch it, and run my application.

The problem: when I press F5 the existing device is not listed and there is no "Create Android emulator" option.
Also, when I press Ctrl+Shift+P and search for "Flutter: Launch Emulator" there is no such command.

Note that if I create the emulator with flutter emulators --create and then start it with flutter emulators --launch then I'm able to run my application using F5 and it's working perfectly fine. However, the Flutter extension won't mention the device if it is not launched, even after restarting VSCode (although it's somehow detected by the Flutter daemon according to logs below).

To Reproduce

  1. Open a local Flutter project
  2. Install Remote Development VSCode extension
  3. Use the following Dockerfile to configure Remote - Containers extension (important: KVM_GID needs to be modified):
FROM ubuntu:20.04

ARG USERNAME=vscode
ARG USER_UID=1000
ARG USER_GID=$USER_UID

# The container is configured for non-root user but we need to access "/dev/kvm" to run emulators.
# We have to map the group owner of "/dev/kvm` from host (which is "kvm") to inside the container.
# So we'll create a new "kvm" group with the id from host returned in "cat /etc/group | grep kvm"). 
ARG KVM_GID=108

RUN groupadd --gid $USER_GID $USERNAME \
    && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \
    && apt-get update \
	&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
        sudo \
        openjdk-8-jdk-headless \
	    wget curl git xz-utils zip unzip libglu1 \
        python3 python3-dev python3-venv python3-pip python3-tk \
        libpulse-dev libxcomposite-dev libxcursor-dev libasound2-dev kmod qemu-kvm \
        ssh vim locate \
	&& apt-get autoremove -y \
	&& apt-get clean -y \
	&& rm -rf /var/lib/apt/lists/* \
    && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
    && chmod 0440 /etc/sudoers.d/$USERNAME \
    && groupadd -g $KVM_GID kvm \
    && adduser $USERNAME kvm

RUN SNIPPET="export PROMPT_COMMAND='history -a' && export HISTFILE=/commandhistory/.bash_history" \
    && mkdir /commandhistory \
    && touch /commandhistory/.bash_history \
    && chown -R $USERNAME /commandhistory \
    && echo $SNIPPET >> "/home/$USERNAME/.bashrc"
    
RUN cd /opt \
	&& wget -O android-sdk-tools.zip https://dl.google.com/android/repository/commandlinetools-linux-6514223_latest.zip \
	&& mkdir -p /opt/android-sdk-linux/cmdline-tools/ \
	&& unzip -q android-sdk-tools.zip -d /opt/android-sdk-linux/cmdline-tools/ \
	&& rm android-sdk-tools.zip \
    && chown -R $USERNAME android-sdk-linux

RUN cd /opt \
    && wget -O flutter_linux.tar.xz https://storage.googleapis.com/flutter_infra/releases/stable/linux/flutter_linux_2.0.5-stable.tar.xz \
    && tar xf flutter_linux.tar.xz \
    && rm flutter_linux.tar.xz \
    && chown -R $USERNAME flutter

RUN cd /opt \
    && wget -O android-studio.tar.gz https://redirector.gvt1.com/edgedl/android/studio/ide-zips/4.1.3.0/android-studio-ide-201.7199119-linux.tar.gz \
    && tar xzvf android-studio.tar.gz \
    && rm android-studio.tar.gz \
    && chown -R $USERNAME android-studio

USER $USERNAME

ENV PATH $PATH:/opt/flutter/bin:/opt/android-sdk-linux/cmdline-tools/tools/bin:/opt/android-sdk-linux/platform-tools:/opt/android-sdk-linux/emulator:/opt/android-studio/bin
ENV ANDROID_SDK_ROOT=/opt/android-sdk-linux

RUN yes | sdkmanager --licenses \
	&& touch $HOME/.android/repositories.cfg \
	&& sdkmanager platform-tools \
	&& sdkmanager emulator \
	&& sdkmanager "platforms;android-29" "build-tools;29.0.3" \
    && sdkmanager "system-images;android-27;google_apis_playstore;x86"

RUN yes | flutter doctor --android-licenses \
    && flutter config --no-enable-web --no-analytics \
    && flutter update-packages \
    && flutter emulators --create --name foobar
  1. Use the following devcontainer.json to configure Remote - Containers extension:
{
	"name": "Dart",
	"build": {
		"dockerfile": "Dockerfile"
	},
	"settings": {
		"terminal.integrated.shell.linux": "/bin/bash"
	},
	"extensions": [
		"dart-code.dart-code",
		"dart-code.flutter",
		"ms-python.python"
	],
	"remoteUser": "vscode",
	"mounts": [
		"source=projectname-bashhistory,target=/commandhistory,type=volume"
	],
	"runArgs": [
		"--device=/dev/kvm",
		"-e",
		"DISPLAY=${localEnv:DISPLAY}",
		"-v",
		"/tmp/.X11-unix:/tmp/.X11-unix"
	],
	"postCreateCommand": "flutter pub get"
}
  1. Use the Remote - Containers extension to build and open your local project in a Docker container.
  2. Install Flutter and Dart extensions inside the remote container.
  3. Press F5 and notice there is no device listed.

Expected behavior
When pressing F5, the "foobar" device should be listed and there should be a "Create Android device" option.
The "Flutter: Launch Emulator" command should also be available.

Screenshots
No screenshots but some outputs.

vscode@4b020da5cc29:/workspaces/myproject$ flutter doctor -v
[✓] Flutter (Channel stable, 2.0.5, on Linux, locale en_US.UTF-8)
    • Flutter version 2.0.5 at /opt/flutter
    • Framework revision adc687823a (2 weeks ago), 2021-04-16 09:40:20 -0700
    • Engine revision b09f014e96
    • Dart version 2.12.3

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    • Android SDK at /opt/android-sdk-linux
    • Platform android-29, build-tools 29.0.3
    • ANDROID_SDK_ROOT = /opt/android-sdk-linux
    • Java binary at: /opt/android-studio/jre/bin/java
    • Java version OpenJDK Runtime Environment (build
      1.8.0_242-release-1644-b3-6222593)
    • All Android licenses accepted.

[✓] Android Studio
    • Android Studio at /opt/android-studio
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build
      1.8.0_242-release-1644-b3-6222593)

[!] Connected device
    ! No devices available

! Doctor found issues in 1 category.
vscode@4b020da5cc29:/workspaces/myproject$ flutter emulators
1 available emulator:

foobar • foobar • Google • android

To run an emulator, run 'flutter emulators --launch <emulator id>'.
To create a new emulator, run 'flutter emulators --create [--name xyz]'.

You can find more information on managing emulators at the links below:
  https://developer.android.com/studio/run/managing-avds
  https://developer.android.com/studio/command-line/avdmanager
vscode@4b020da5cc29:/workspaces/myproject$ flutter devices  
No devices detected.

Run "flutter emulators" to list and start any available device emulators.

If you expected your device to be detected, please run "flutter doctor" to diagnose potential issues. You may also try increasing the time to wait for connected devices with the
--device-timeout flag. Visit https://flutter.dev/setup/ for troubleshooting tips.
vscode@4b020da5cc29:/workspaces/myproject$ cat logs/flutter-daemon.log 
!! PLEASE REVIEW THIS LOG FOR SENSITIVE INFORMATION BEFORE SHARING !!

Dart Code extension: 3.21.1
Flutter extension: 3.21.0 (not activated)

App: Visual Studio Code
Remote: dev-container
Version: 1.55.2
Platform: linux

HTTP_PROXY: undefined
NO_PROXY: undefined

Logging Categories:
    FlutterDaemon

Sun May 02 2021 [15:06:40 GMT+0000 (Coordinated Universal Time)] Log file started
[3:06:40 PM] [FlutterDaemon] [Info] Spawning /opt/flutter/bin/flutter with args ["daemon","--show-web-server-device"]
[3:06:40 PM] [FlutterDaemon] [Info] ..  in /opt/flutter
[3:06:40 PM] [FlutterDaemon] [Info] ..  with {"toolEnv":{"FLUTTER_HOST":"VSCode","PUB_ENVIRONMENT":"vscode.dart-code"}}
[3:06:40 PM] [FlutterDaemon] [Info]     PID: 236
[3:06:40 PM] [FlutterDaemon] [Info] ==> [{"id":"1","method":"emulator.getEmulators"}]
[3:06:42 PM] [FlutterDaemon] [Info] <== [{"event":"daemon.connected","params":{"version":"0.6.0","pid":407}}]
[3:06:42 PM] [FlutterDaemon] [Info] ==> [{"id":"2","method":"device.enable"}]
[3:06:42 PM] [FlutterDaemon] [Info] <== [{"event":"daemon.logMessage","params":{"level":"status","message":"Starting device daemon..."}}]
[3:06:42 PM] [FlutterDaemon] [Info] <== [{"id":"2"}]
[3:06:42 PM] [FlutterDaemon] [Info] <== [{"id":"1","result":[{"id":"foobar","name":"foobar","category":"mobile","platformType":"android"}]}]
[3:07:01 PM] [FlutterDaemon] [Info] ==> [{"id":"3","method":"daemon.getSupportedPlatforms","params":{"projectRoot":"/workspaces/myproject"}}]
[3:07:01 PM] [FlutterDaemon] [Info] <== [{"id":"3","result":{"platforms":["ios","android"]}}]
[3:07:02 PM] [FlutterDaemon] [Info] ==> [{"id":"4","method":"daemon.getSupportedPlatforms","params":{"projectRoot":"/workspaces/myproject"}}]
[3:07:02 PM] [FlutterDaemon] [Info] <== [{"id":"4","result":{"platforms":["ios","android"]}}]
[3:07:02 PM] [General] [Warn] Unable to launch due to no active device
vscode@4b020da5cc29:/workspaces/myproject$ cat logs/dart-application.log 
!! PLEASE REVIEW THIS LOG FOR SENSITIVE INFORMATION BEFORE SHARING !!

Dart Code extension: 3.21.1
Flutter extension: 3.21.0 (not activated)

App: Visual Studio Code
Remote: dev-container
Version: 1.55.2
Platform: linux

HTTP_PROXY: undefined
NO_PROXY: undefined

Logging Categories:
    General

Sun May 02 2021 [15:06:40 GMT+0000 (Coordinated Universal Time)] Log file started
[3:06:40 PM] [General] [Info] Searching for SDKs...
[3:06:40 PM] [General] [Info] Environment PATH:
[3:06:40 PM] [General] [Info]     /vscode/vscode-server/bin/x64/3c4e3df9e89829dce27b7b5c24508306b151f30d/bin
[3:06:40 PM] [General] [Info]     /usr/local/sbin
[3:06:40 PM] [General] [Info]     /usr/local/bin
[3:06:40 PM] [General] [Info]     /usr/sbin
[3:06:40 PM] [General] [Info]     /usr/bin
[3:06:40 PM] [General] [Info]     /sbin
[3:06:40 PM] [General] [Info]     /bin
[3:06:40 PM] [General] [Info]     /opt/flutter/bin
[3:06:40 PM] [General] [Info]     /opt/android-sdk-linux/cmdline-tools/tools/bin
[3:06:40 PM] [General] [Info]     /opt/android-sdk-linux/platform-tools
[3:06:40 PM] [General] [Info]     /opt/android-sdk-linux/emulator
[3:06:40 PM] [General] [Info]     /opt/android-studio/bin
[3:06:40 PM] [General] [Info] Found Flutter project at /workspaces/myproject:
                        Mobile? true
                        Web? false
                        Create Trigger? false
                        Flutter Repo? false
[3:06:40 PM] [General] [Info] Searching for flutter
[3:06:40 PM] [General] [Info]     Looking for flutter in:
[3:06:40 PM] [General] [Info]         /workspaces/myproject
[3:06:40 PM] [General] [Info]         /workspaces/myproject/bin
[3:06:40 PM] [General] [Info]         /opt/flutter/bin/
[3:06:40 PM] [General] [Info]         /workspaces/myproject/.flutter
[3:06:40 PM] [General] [Info]         /workspaces/myproject/.flutter/bin
[3:06:40 PM] [General] [Info]         /workspaces/myproject/vendor/flutter
[3:06:40 PM] [General] [Info]         /workspaces/myproject/vendor/flutter/bin
[3:06:40 PM] [General] [Info]         /home/vscode/snap/flutter/common/flutter
[3:06:40 PM] [General] [Info]         /home/vscode/snap/flutter/common/flutter/bin
[3:06:40 PM] [General] [Info]         /vscode/vscode-server/bin/x64/3c4e3df9e89829dce27b7b5c24508306b151f30d/bin
[3:06:40 PM] [General] [Info]         /usr/local/sbin
[3:06:40 PM] [General] [Info]         /usr/local/bin
[3:06:40 PM] [General] [Info]         /usr/sbin
[3:06:40 PM] [General] [Info]         /usr/bin
[3:06:40 PM] [General] [Info]         /sbin
[3:06:40 PM] [General] [Info]         /bin
[3:06:40 PM] [General] [Info]         /opt/flutter/bin
[3:06:40 PM] [General] [Info]         /opt/android-sdk-linux/cmdline-tools/tools/bin
[3:06:40 PM] [General] [Info]         /opt/android-sdk-linux/platform-tools
[3:06:40 PM] [General] [Info]         /opt/android-sdk-linux/platform-tools/bin
[3:06:40 PM] [General] [Info]         /opt/android-sdk-linux/emulator
[3:06:40 PM] [General] [Info]         /opt/android-sdk-linux/emulator/bin
[3:06:40 PM] [General] [Info]         /opt/android-studio/bin
[3:06:40 PM] [General] [Info]     Found at:
[3:06:40 PM] [General] [Info]         /opt/flutter/bin/
[3:06:40 PM] [General] [Info]         /opt/flutter/bin
[3:06:40 PM] [General] [Info]     Candidate paths to be post-filtered:
[3:06:40 PM] [General] [Info]         /opt/flutter
[3:06:40 PM] [General] [Info]         /opt/flutter
[3:06:40 PM] [General] [Info]     Found at /opt/flutter
[3:06:40 PM] [General] [Info]     Returning SDK path /opt/flutter for flutter
[3:06:40 PM] [General] [Info] Searching for dart
[3:06:40 PM] [General] [Info]     Looking for dart in:
[3:06:40 PM] [General] [Info]         /opt/flutter/bin/cache/dart-sdk
[3:06:40 PM] [General] [Info]         /opt/flutter/bin/cache/dart-sdk/bin
[3:06:40 PM] [General] [Info]         /vscode/vscode-server/bin/x64/3c4e3df9e89829dce27b7b5c24508306b151f30d/bin
[3:06:40 PM] [General] [Info]         /usr/local/sbin
[3:06:40 PM] [General] [Info]         /usr/local/bin
[3:06:40 PM] [General] [Info]         /usr/sbin
[3:06:40 PM] [General] [Info]         /usr/bin
[3:06:40 PM] [General] [Info]         /sbin
[3:06:40 PM] [General] [Info]         /bin
[3:06:40 PM] [General] [Info]         /opt/flutter/bin
[3:06:40 PM] [General] [Info]         /opt/android-sdk-linux/cmdline-tools/tools/bin
[3:06:40 PM] [General] [Info]         /opt/android-sdk-linux/platform-tools
[3:06:40 PM] [General] [Info]         /opt/android-sdk-linux/platform-tools/bin
[3:06:40 PM] [General] [Info]         /opt/android-sdk-linux/emulator
[3:06:40 PM] [General] [Info]         /opt/android-sdk-linux/emulator/bin
[3:06:40 PM] [General] [Info]         /opt/android-studio/bin
[3:06:40 PM] [General] [Info]         /opt/flutter/bin/cache/dart-sdk
[3:06:40 PM] [General] [Info]         /opt/flutter/bin/cache/dart-sdk/bin
[3:06:40 PM] [General] [Info]     Found at:
[3:06:40 PM] [General] [Info]         /opt/flutter/bin/cache/dart-sdk/bin
[3:06:40 PM] [General] [Info]         /opt/flutter/bin
[3:06:40 PM] [General] [Info]         /opt/flutter/bin/cache/dart-sdk/bin
[3:06:40 PM] [General] [Info]     Candidate paths to be post-filtered:
[3:06:40 PM] [General] [Info]         /opt/flutter/bin/cache/dart-sdk
[3:06:40 PM] [General] [Info]         /opt/flutter
[3:06:40 PM] [General] [Info]         /opt/flutter/bin/cache/dart-sdk
[3:06:40 PM] [General] [Info]     Found at /opt/flutter/bin/cache/dart-sdk
[3:06:40 PM] [General] [Info]     Returning SDK path /opt/flutter/bin/cache/dart-sdk for dart
[3:06:40 PM] [General] [Info] Experiment random number is 81 for experiement 'lsp-default'. Experiment is enabled for <= 10
[3:06:40 PM] [General] [Info] !! PLEASE REVIEW THIS LOG FOR SENSITIVE INFORMATION BEFORE SHARING !!

Dart Code extension: 3.21.1
Flutter extension: 3.21.0 (not activated)

App: Visual Studio Code
Remote: dev-container
Version: 1.55.2
Platform: linux

Workspace type: Flutter
Analyzer type: DAS
Multi-root?: false

Dart SDK:
    Loc: /opt/flutter/bin/cache/dart-sdk
    Ver: 2.12.3
Flutter SDK:
    Loc: /opt/flutter
    Ver: 2.0.5

HTTP_PROXY: undefined
NO_PROXY: undefined
[3:06:40 PM] [General] [Info] Spawning /opt/flutter/bin/cache/dart-sdk/bin/pub with args ["global","list"]
[3:06:40 PM] [General] [Info] Activating Flutter extension for Flutter project...
[3:06:40 PM] [General] [Info] Extension:Startup timing: 158ms
[3:06:40 PM] [General] [Info] Found 0 folders requiring "pub get":
[3:06:40 PM] [General] [Info] !! PLEASE REVIEW THIS LOG FOR SENSITIVE INFORMATION BEFORE SHARING !!

Dart Code extension: 3.21.1
Flutter extension: 3.21.0 (activated)

App: Visual Studio Code
Remote: dev-container
Version: 1.55.2
Platform: linux

Workspace type: Flutter
Analyzer type: DAS
Multi-root?: false

Dart SDK:
    Loc: /opt/flutter/bin/cache/dart-sdk
    Ver: 2.12.3
Flutter SDK:
    Loc: /opt/flutter
    Ver: 2.0.5

HTTP_PROXY: undefined
NO_PROXY: undefined
[3:06:40 PM] [General] [Info] devtools has no installed version, returning NotInstalled
[3:06:40 PM] [General] [Info] Spawning /opt/flutter/bin/cache/dart-sdk/bin/pub with args ["global","activate","devtools"]
[3:06:41 PM] [General] [Info] Analyzer:Startup timing: 1248ms
[3:06:54 PM] [General] [Info] Spawning /opt/flutter/bin/cache/dart-sdk/bin/pub with args ["global","list"]
[3:06:54 PM] [General] [Info] devtools version 2.1.1 appears to be latest so returning Valid
[3:07:01 PM] [General] [Info] Starting debug session...
[3:07:01 PM] [General] [Info]     workspace: /workspaces/myproject
[3:07:01 PM] [General] [Info] Using found common entry point: /workspaces/myproject/lib/main.dart
[3:07:01 PM] [General] [Info] Using workspace as cwd: /workspaces/myproject
[3:07:01 PM] [General] [Info] Detected launch project as Flutter
[3:07:01 PM] [General] [Info] Using Flutter debug adapter for this session
[3:07:02 PM] [General] [Warn] Unable to launch due to no active device

Versions:

  • VS Code version: 1.55.2
  • Dart extension version: 3.21.1 (Dart) / 3.21.0 (Flutter)
  • Dart/Flutter SDK version: 2.12.13 (Dart) / 2.0.5 (Flutter)
@Delgan Delgan added the is bug label May 2, 2021
@DanTup
Copy link
Member

DanTup commented May 3, 2021

Can you confirm exactly what the setup here is? If you're using Remote Containers, then the extension code is all running on the remote machine. Launching an emulator on a remote machine usually doesn't make much sense (as remote machines tend to not be able to interact with the local desktop). Are you running something that would allow an Android emulator launched inside the remote to be visible to you on the local machine?

Can you also confirm which device you're expecting to see but don't? In the log it looks like a device named foobar shows up in the deamon - is that not the device you're after, or is it not showing in the UI despite showing up in the daemon logs?

Thanks!

@DanTup DanTup added the awaiting info Requires more information from the customer to progress label May 3, 2021
@DanTup
Copy link
Member

DanTup commented May 3, 2021

Sorry, I re-read and see you already mentioned "foobar" was the correct one.

Can you confirm if you have a launch.json file, and if so, whether it sets the deviceId property?

I've pushed a change (d79716b) that might improve the logging when this occurs that'll be in the upcoming release otherwise, which might help understand what's failing.

@Delgan
Copy link
Contributor Author

Delgan commented May 3, 2021

Can you confirm exactly what the setup here is? If you're using Remote Containers, then the extension code is all running on the remote machine. Launching an emulator on a remote machine usually doesn't make much sense (as remote machines tend to not be able to interact with the local desktop).

I'm using the Remote Containers extension, but the container is actually run on my local machine.

Are you running something that would allow an Android emulator launched inside the remote to be visible to you on the local machine?

Indeed! This is possible thanks to parameters passed to the run command while starting the Docker container. It can be seen in the devcontainer.json file I shared.

The --device=/dev/kvm is there so that the container can emulate an Android device (required for hardware acceleration I guess).

The -e DISPLAY=${localEnv:DISPLAY} -v tmp/.X11-unix:/tmp/.X11-unix allows GUI application started in the container to be displayed on the host.

This solution allows me to start and use the emulator without any host dependency.

Sorry, I re-read and see you already mentioned "foobar" was the correct one.

Yes. 👍

Can you confirm if you have a launch.json file, and if so, whether it sets the deviceId property?

The launch.json is the default one:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Flutter (Debug)",
            "request": "launch",
            "type": "dart",
            "flutterMode": "debug"
        },
        {
            "name": "Flutter (Release)",
            "request": "launch",
            "type": "dart",
            "flutterMode": "release"
        }
    ]
}

I've pushed a change (d79716b) that might improve the logging when this occurs that'll be in the upcoming release otherwise, which might help understand what's failing.

Actually I was a bit curious and tried to look at the source code and possible causes.

My bet is that getPickableEmulators() returns an empty list due to isRunningLocally being false.

public async getPickableEmulators(showAsEmulators: boolean, supportedTypes?: f.PlatformType[]): Promise<PickableDevice[]> {
if (!isRunningLocally)
return [];

export const isRunningLocally =
// Some cloud IDEs mis-report the extension kind, so if we _know_ something is a cloud IDE,
// override that.
!isKnownCloudIde
&& (!dartExtension || dartExtension.extensionKind === ExtensionKind.UI);

I was thinking that maybe adding | vscode.env.remoteName === "dev-container" would solve the problem. However, I don't know if modifying this variable could have other unwanted side effects. What do you think?

@DanTup
Copy link
Member

DanTup commented May 3, 2021

My bet is that getPickableEmulators() returns an empty list due to isRunningLocally being false.

Ah, good spot - I'm not sure how I overlooked that when checking 🙈

I was thinking that maybe adding || vscode.env.remoteName === "dev-container"

I don't think that's an ideal fix, as this change was specifically to try and hide them where they might not work (eg. where you can't see the interactive processes launched in the container/remote). I think it may be better to have an enum setting similar to dart.flutterShowWebServerDevice for "show emulators" that lets you pick whether they show only when running locally, or always (the default being "local" to preserve current behaviour, but users who are specifically using remotes that can launch them can change the setting).

What do you think?

@DanTup DanTup added in flutter Relates to running Flutter apps in remote Relates to running the extension in a remote setting using VS Code's remote dev support is enhancement and removed awaiting info Requires more information from the customer to progress is bug labels May 3, 2021
@DanTup DanTup changed the title Unable to create / select / launch emulator device from within Docker remote container Support running emulators when running in remote/container environments May 3, 2021
@Delgan
Copy link
Contributor Author

Delgan commented May 3, 2021

Yes, you are right. Better not to try to guess the configuration, there will surely be other special cases. It's easier to be explicit. An additional parameter would solve the problem perfectly! 👍

@DanTup
Copy link
Member

DanTup commented May 26, 2021

There's a beta version with the changes in here if you'd like to test it out before release:

https://github.com/Dart-Code/Dart-Code/releases/tag/v3.23.0-beta.1

If anything doesn't work as expected, please let me know!

@Delgan
Copy link
Contributor Author

Delgan commented May 26, 2021

@DanTup Just installed the beta and tried the new settings parameter: it works like a charm now! Thanks again. 🎉

@DanTup
Copy link
Member

DanTup commented May 26, 2021

Great, thanks for confirming! :-)

@pedro-gilmora
Copy link

Is there an example repo of remote Android emulator for Flutter in Codespaces?

@DanTup
Copy link
Member

DanTup commented Mar 1, 2023

@pedro-gilmora the issue was for the case where emulators launched in the "remote" were visible on the desktop. I don't think this is possible on Codespaces.

However, if you have a remote Android emulator then in theory you can adb connect to it in Codespaces, and then it should be detected by flutter devices. I tested this some time ago with a Genymotion emulator, but I haven't tried recently since their service is not free and I haven't had any need for it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in flutter Relates to running Flutter apps in remote Relates to running the extension in a remote setting using VS Code's remote dev support is enhancement
Projects
None yet
Development

No branches or pull requests

3 participants