如何将我的Android模拟器连接到互联网,例如使用浏览器?我已经找到了很多关于如何通过代理连接的建议,但这里不是这样,我的机器(Windows 7)是直接连接到路由器的。
当前回答
(编辑) 对于最新版本的Android Studio,你需要使用的模拟器不再在~/Library/Android/sdk/tools文件夹中,而是在~/LibraryAndroid/sdk/emulator中。 如果在尝试下面的解决方案时,您会得到以下消息“PANIC:缺少'x86' CPU的模拟器引擎程序。,然后请参考https://stackoverflow.com/a/49511666更新您的bash环境。
操作系统:Mac OS X El Capitan
IDE: Android Studio 2.2
由于某些原因,我无法通过工作时的AVD访问互联网(可能是代理或网络配置问题)。 对我来说,诀窍是在命令行启动我的AVD,并手动提供谷歌公共DNS 8.8.8.8。
在你的终端中,进入Android sdk的文件夹工具,找到“模拟器”程序:
cd ~/Library/Android/sdk/tools
然后检索avd的名称:
emulator -list-avds
它会返回如下内容:
Android_Wear_Round_API_23
Nexus_10_API_22
Nexus_5X_API_22
Nexus_5X_API_24
Nexus_9_API_24
然后按以下指示启动您想要的AVD:
emulator -avd NameOfYourDevice -dns-server 8.8.8.8
您的AVD已经启动,您应该可以使用互联网了。
其他回答
I have Mac OS X 10.7.2, Eclipse Helios Service Release 2. I also work via Proxy and my IP settings are via DHCP. I solved this issue firstly using this article http://www.gitshah.com/2011/02/android-fixing-no-internet-connection.html, then I removed Emulator settings and just go to Run->Run Configurations->Target->Additional Emulator Command Line Options and type there -http-proxy xxx.xx.111.1:3128 . Also I would like to say that when I typed also a DNS like this: -dns-server xxx.xx.111.1 -http-proxy xxx.xx.111.1:3128 it did not work, but when I removed DNS it worked. Also I would like to note, that Additional Emulator Command Line Options are not visible without scrolling to the bottom of that window. I also want to note, that when you change emulator options, all apps will work. But If you write Additional Emulator Command Line Options, you need to write them every time for every app target in Run Configurations.
为了使用互联网通过代理模拟器尝试这些步骤,它为我工作:
进入设置->无线和网络->移动网络->接入点名称。 按菜单键。将出现一个选项菜单。
从选项菜单中选择新建APN。
单击“名称”。提供名称apn说我的apn。
点击APN。输入www。
点击代理。输入您的代理服务器IP。您可以从Internet explorer Internet选项菜单中获得它。
单击Port。输入端口号,在我的例子中是8080。您可以从Internet explorer Internet选项菜单中获得它。
单击User-name。以域名\user-name格式提供用户名。通常是你的系统登录。
点击密码。提供您的系统密码。
再次按菜单键。将出现一个选项菜单。
按下保存并尝试打开浏览器。我想这对你有帮助。
我有一台windows 7(64位)的机器,我的模拟器不能工作。在四处寻找之后,我最终静态地将我的路由器添加到网络DNS属性(192.168.1.1)。它开始起作用了。
读完这篇文章后,我决定看看我的“网卡”。我把它放在引号里,因为像许多人一样,我正在为Hamachi和virtual Box等设备运行虚拟网卡。在我禁用了Hamachi之后,我可以使用互联网了。我的猜测是模拟器选择第一个可用的nic,而不管它是否是虚拟的。现在来看看我是否可以重新安排我的nic订单而不撕裂我的盒子。
Windows 7 32位
it appears there might be a few reasons why there might be no internet connection for an emulator, in my case i was working from home where i have a wireless connection then came into the office and plugged in direct, however although my wireless connection was disconnected it was not disabled resulting in no emulator connection. my understanding is that when it starts up it looks for a network adapter and if there is any conflict here it might result in no internet connection. to resolve go to Start > Settings > Network Connections right click on Wireless Network Connection (if you are not using wireless) and select disable
推荐文章
- 如何增加Android模拟器的存储?(INSTALL_FAILED_INSUFFICIENT_STORAGE)
- Android模拟器没有启动,显示“无效的命令行参数”
- 新版本的Android模拟器问题-模拟器进程已终止
- Android模拟器只显示黑屏和adb设备显示“设备离线”
- 在Android Studio的模拟器上截图
- 使Android模拟器运行得更快
- Android Studio错误:“Manifest合并失败:针对Android 12的应用程序”
- 我如何在Android模拟器中“摇动”Android设备以调出开发菜单来调试我的React Native应用程序
- 错误“与adb的连接中断,发生严重错误。”
- 从Android模拟器访问localhost:端口
- Android模拟器在Android Studio中被杀死
- 以编程方式在视图上添加填充
- 如何连接安卓模拟器到互联网
- 模拟器:ERROR: x86仿真目前需要硬件加速
- 运行新的Intel Android模拟器