There are many similar questions out there, but none of them help (for instance, this question is well upvoted, with a well upvoted answer, and would seem to be a dupe. BUT like others who commented there, the answer did not help me (also, the answer is 2 years old, which is an eternity on Flutter)).
At most, they tell how to add an Android VM in Android Studio. I have done so:
They also suggest setting the environment variables ANDROID_HOME
and/or ANDROID_SDK_ROOT
. I have set both to the same value:
C:\Users\me>dir %ANDROID_HOME%
Volume in drive C is Windows
Volume Serial Number is FE0C-16F0
Directory of C:\Users\me\AppData\Local\Android\sdk
17/06/2020 12:18 <DIR> .
17/06/2020 12:18 <DIR> ..
19/06/2020 10:46 <DIR> .downloadIntermediates
20/06/2020 07:22 16 .knownPackages
19/06/2020 10:47 <DIR> .temp
14/06/2020 13:15 <DIR> build-tools
17/06/2020 12:18 <DIR> cmdline-tools
08/06/2020 13:53 <DIR> emulator
08/06/2020 18:35 <DIR> extras
16/06/2020 12:50 <DIR> licenses
08/06/2020 13:53 <DIR> patcher
19/06/2020 10:47 <DIR> platform-tools
08/06/2020 19:21 <DIR> platforms
16/06/2020 12:59 <DIR> skins
08/06/2020 13:55 <DIR> sources
14/06/2020 13:15 <DIR> system-images
08/06/2020 13:54 <DIR> tools
1 File(s) 16 bytes
16 Dir(s) 18,697,719,808 bytes free
C:\Users\me>
When I create the default Flutter app, Android Studio shows me the VMs as an option for run/debug:
BUT, when I open that same project's folder (or any other) with Visual Studio Code and run, it launches in the Chrome browser, because:
PS C:\Users\me\AndroidStudioProjects\flutter_app> flutter devices
3 connected devices:
Web Server • web-server • web-javascript • Flutter Tools
Chrome • chrome • web-javascript • Google Chrome 83.0.4103.106
Edge • edge • web-javascript • Microsoft Edge 83.0.478.54
PS C:\Users\me\AndroidStudioProjects\flutter_app>
How do get Flutter to recognize my Android virtual machines?
I can see that each has a sub-directory in c:\Users\me\.android\avd
. How do I make Flutter aware of it?
Here's the output of Flutter doctor, for completeness:
C:\Users\me>flutter doctor -v
[√] Flutter (Channel master, 1.20.0-1.0.pre.132, on Microsoft Windows [Version 10.0.18363.900], locale en-GB)
• Flutter version 1.20.0-1.0.pre.132 at e:\coding\flutter
• Framework revision 5995661777 (8 hours ago), 2020-06-19 16:15:58 -0700
• Engine revision 676cd566f7
• Dart version 2.9.0 (build 2.9.0-17.0.dev 7e72c9ae7e)
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
• Android SDK at C:\Users\me\AppData\Local\Android\sdk
• Platform android-R, build-tools 29.0.3
• ANDROID_HOME = C:\Users\me\AppData\Local\Android\sdk
• ANDROID_SDK_ROOT = C:\Users\me\AppData\Local\Android\sdk
• Java binary at: E:\coding\Android_studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
[√] Android Studio (version 4.0)
• Android Studio at E:\coding\Android_studio
• Flutter plugin version 46.0.2
• Dart plugin version 193.7361
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
[√] Connected device (3 available)
• Web Server • web-server • web-javascript • Flutter Tools
• Chrome • chrome • web-javascript • Google Chrome 83.0.4103.106
• Edge • edge • web-javascript • Microsoft Edge 83.0.478.54
• No issues found!
C:\Users\me>
This is interesting: when I run a Flutter app in Android Studio, its VM suddenly becomes visible in Flutter/Visual Studio Code:
PS C:\Users\me\AndroidStudioProjects\flutter_app> flutter devices 4 connected devices:
sdk gphone x86 arm • emulator-5554 • android-x86 • Android 11 (API 30) (emulator) Web Server • web-server • web-javascript •
Flutter Tools Chrome • chrome • web-javascript •
Google Chrome 83.0.4103.106 Edge • edge •
web-javascript • Microsoft Edge 83.0.478.54 PS
C:\Users\me\AndroidStudioProjects\flutter_app>
When I stop the device in Android Studio, Flutter can no longer see it.