<Flutter> emulator launched but not detected by android studio

房东的猫 提交于 2019-12-31 01:51:25

问题


I'm a beginner in Flutter and I've an emulator opened/powered on and android studio doesn't detect it. 1

hence I can't run any program because "no device is running". I've tried installing 'Android emulator' in the SDK tools but android studio still cant detect it.


回答1:


In a windows platform I did:

If you have ran flutter doctor and there is no issues and if you can run your flutter app in cmd or using VSCode:

Just try to open Android Studio or IntelliJ as administrator by right clicking on the icon. This may list down devices and solve your problem.

The reason may be you have cloned flutter repository or you don't have right permission in flutter installed directory.




回答2:


Run flutter doctor command to check whats the problem.

In terminal, run the flutter devices command to verify that Flutter recognizes your connected Android device. Check your flutter plugin whether it is up to date.

And read this flutter run: No connected devices , You may find the solution.




回答3:


For me (on a Mac) I had the Android SDK installed in a custom location so I needed to set the ANDROID_HOME environment variable. In the terminal you can check what this value is with:

echo $ANDROID_HOME

I added the Android SDK to my .bash_profile (might be a different file if you are using Linux or Windows) for both ANDROID_HOME and PATH.

# already had these
export PATH="$PATH":"/opt/android-sdk/tools"
export PATH="$PATH":"/opt/flutter-sdk/bin"

# added this
export ANDROID_HOME="/opt/android-sdk"

Replace /opt/android-sdk with wherever yours is.

Then I updated the variables with

source .bash_profile

Testing with flutter doctor showed it was working.

flutter doctor

I restarted Android Studio and the emulator worked.




回答4:


I had same problem.

CMD: flutter devices
No devices detected.

CMD: device emulators
Device emulator-5554 is offline.

In Android virtual device manager, I cold boot emulator and it started working.



来源:https://stackoverflow.com/questions/51267109/flutter-emulator-launched-but-not-detected-by-android-studio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!