How to connect android emulator to the internet

前端 未结 30 1933
独厮守ぢ
独厮守ぢ 2020-11-22 04:38

How can I connect my Android emulator to the internet, e.g. to use the browser? I\'ve found lots of advice on what do to when your connected through a proxy, but that\'s not

30条回答
  •  执笔经年
    2020-11-22 05:01

    [EDIT] For more recent version of Android Studio, the emulator you need to use is no longer in the ~/Library/Android/sdk/tools folder but in ~/LibraryAndroid/sdk/emulator. If while trying the below solution you get the following message "PANIC: Missing emulator engine program for 'x86' CPU.”, then please refer to https://stackoverflow.com/a/49511666 to update your bash environment.

    Operating System : Mac OS X El Capitan

    IDE : Android Studio 2.2

    For some reasons, I wasn't able to access internet through my AVD at work (probably proxy or network configuration issues). What did the trick for me was to launch in command line my AVD and giving manually the Google public DNS 8.8.8.8.

    In your Terminal go to the folder tools of your Android sdk to find the 'emulator' program:

    cd ~/Library/Android/sdk/tools
    

    Then retrieve the name of your AVDs :

    emulator -list-avds
    

    It will return you something like this:

    Android_Wear_Round_API_23
    Nexus_10_API_22
    Nexus_5X_API_22
    Nexus_5X_API_24
    Nexus_9_API_24
    

    Then launch the AVD you would like with the following instructions:

    emulator -avd NameOfYourDevice -dns-server 8.8.8.8
    

    Your AVD is launched and you should be able to use internet.

提交回复
热议问题