Search code examples
flutterandroid-studiostartup

How to Automate Flutter Device Selection on Android Studio Startup? (Android Studio)


Every time I start Android Studio, I have to go through the same routine:

  • Moving the mouse to the dropdown menu for Flutter Device Selection
  • Clicking on "Refresh" so that Flutter Device Selection can find the emulators
  • Selecting the emulator to start up

I feel that all of this is unnecessary work. Therefore, I looked for a way to automatically select the emulator instead of going through the same routine each time, but I couldn't find an option for that in the settings.

Do anyone have an idea about how to automate that work?


Solution

  • I found a solution using a script at startup of android studio.

    From Settings > Startup Tasks > Add new configuration > Shell script > Choose for Execute: Script text > Script text: "flutter emulators --launch Pixel_6_Pro_API_34" > choose for Execute in the terminal > click apply or ok .

    This works for me, it will force the emulator to launch on android studio startup.

    You can surly change Pixel_6_Pro_API_34 to the device ID that u are using.