emulator launched but not detected by android studio

前端 未结 6 1710
情话喂你
情话喂你 2021-01-12 05:42

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

6条回答
  •  萌比男神i
    2021-01-12 06:21

    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.

提交回复
热议问题