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 ru
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.