Dmitry Bubnenkov
Dmitry Bubnenkov

Reputation: 9869

Change default build target from flutter for web to flutter for Android

I am using VS Code. After some experiments with building flutter for web it's began to build every project for web be default. I need to get it back by default Android version.

PS D:\code\2019\dart_app1\app1> flutter devices
2 connected devices:
Windows • Windows • windows-x64    • Microsoft Windows [Version 10.0.17134.984]
Chrome  • chrome  • web-javascript • Google Chrome 76.0.3809.132
>PS D:\code\2019\dart_app1\app1> flutter emulators
3 available emulators:
Nexus_5X_API_29  • Nexus 5X API 29  • Google • android
Nexus_9_API_28   • Nexus 9 API 28   • Google • android
flutter_emulator • flutter emulator • 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

launch.json:

{
    // 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",
            "request": "launch",
            "type": "dart"
        }
    ]
}

Upvotes: 9

Views: 5968

Answers (2)

Mike Cheel
Mike Cheel

Reputation: 13116

Inside VS Code (assuming you have the flutter extension) you can now:

Hit CTRL+Shift+P and then choose Futter: Select Device

This will enable you to switch to a different device from inside VS Code.

You can (also assuming you have the latest version of the Flutter extension) change it from the bottom right bar.

Upvotes: 0

Spatz
Spatz

Reputation: 20118

Specify your device in launch.json file with args parameter:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Flutter",
            "request": "launch",
            "type": "dart",
            "args": ["-d", "<device name from adb devices output>"]
        }
    ]
}

Or select from vscode bottom panel at right side. By default launcher select first available device, and chrome device probably always that.

Upvotes: 17

Related Questions