如何将我的Android模拟器连接到互联网,例如使用浏览器?我已经找到了很多关于如何通过代理连接的建议,但这里不是这样,我的机器(Windows 7)是直接连接到路由器的。
当前回答
如果你用的是Mac,试试这个
去苹果图标->系统首选项->网络 点击齿轮图标,选择“设置服务订单” 将活动接口置于其他接口之前。 重新启动Android模拟器。
其他回答
I think some of the answers may have addressed this, however obliquely, but here's what worked for me. Assuming your problem is occurring when you're on a wireless network and you have a LAN card installed, the issue is that the emulator tries to obtain its DNS settings from that LAN card. Not a problem when you're connected via that LAN, but utterly useless if you're on a wireless connection. I noticed this when I was on my laptop. So, how to fix? Simple: Disable your LAN card. Really. Just go to your Network connections, find your LAN card, right click it and choose disable. Now try your emulator. If you're like me, it suddenly ... works!
在eclipse中转到DDMS
在DDMS下选择模拟器控制,其中包含电话状态 在电话状态包含数据——>选择Home,这将启用您的互联网连接,如果您想禁用模拟器的互联网连接,那么——>选择None
(注意:只有当运行eclipse的PC/笔记本电脑有活跃的internet连接时,才会启用internet连接。)
这个问题有不同的解决办法。其中之一,我将向您展示我的实验和结果,使用最近的android studio和2017年下载的AVD图像。
你要做的第一件事是从android工作室启动你的AVD。(在我的情况下,我选择NEXUSAPI25安卓7.1图像) 转到设置->无线和网络->蜂窝网络->接入点->(+)按add ->输入以下如果你没有NTLM代理或代理在所有(这意味着你是直接连接) a.添加apn名称为myAPN B.添加apn服务器=> WWW C.保存并尝试浏览互联网。
如果这不起作用,在你的环境变量中添加“ANDROID_SDK_ROOT”
然后,使用模拟器命令启动AVD,如下所示
模拟器-avd Nexus25 -dns-server 8.8.8.8
对于那些使用NTLM代理的人,接下来我将向您展示它如何为我工作。 将Android_sdk_root路径添加到环境变量中。这使得命令行代码像使用AVD名称一样读取成功。 使用以下命令启动模拟器
>模拟器-avd Nexus_5X_API_25 -http-proxy http://username:password@ipaddress:端口
输入
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
我的平台:Mac OS 10.6.4 Eclipse: 3.6
我也遇到过类似的问题,我的地图应用程序背景是灰色的(没有磁贴),浏览器无法连接到互联网。
在Eclipse中,我去运行配置->目标,并添加“-dns-server X.X.X.X”,之后一切都工作正常。(显然,X.X.X.X是我的DNS服务器的IP地址)。
推荐文章
- 如何增加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模拟器