android - 没有互联网连接的 Visual Studio Xamarin 和 Android 模拟器

标签 android visual-studio xamarin

我正在使用 Visual Studio 2015 开发 Xamarin 项目。

问题是我无法使用 Internet 从 Visual Studio 启动 Android 模拟器。我在代理后面。

使用 HttpWebRequest ,我得到错误:

System.Net.WebException: Error: ConnectFailure (Network is unreachable)

我检查了模拟器,没有检测到互联网连接:

enter image description here

我能够使用命令行(使用 emulator.exe -avd avdName -dns-server 192.168.1.1 )启动模拟器设置代理/dns,但不能从 Visual Studio 启动。

我的问题是:是否有任何方法可以从 Visual Studio 或任何配置文件(例如 Avd 文件夹中的 .ini 或 config.ini)或任何其他方式为 Android Emulator 设置代理/dns 配置?

最佳答案

我很确定你从那时起就解决了你的问题,但我遇到了同样的问题并找到了以下解决方案:

在 Preferences/Projects/Android 中,只需在“additional emulator launch arguments”中设置 -dns-server 8.8.8.8(虽然不确定它是如何翻译成英文的)。

Xamarin Visual Studio Community preferences (screen capture)

关于android - 没有互联网连接的 Visual Studio Xamarin 和 Android 模拟器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41877166/

相关文章:

android - Blackberry 应用程序在启动时自动最小化

java - 与电子邮件地址的对话

windows - 如何在无人值守的情况下安装 Visual Studio Build Tools?

c# - 如何在 Visual Studio 中查找没有命名空间的 C# 文件?

sql-server - Microsoft.SqlServer.SqlTools.VSIntegration 引用问题/Visual Studio 2010 中的异常

c# - 为什么 TextChanged 事件在此 Xamarin.Android 代码中不起作用?

android - 将布局另存为位图

c# - 将 ZipArchiveEntry.CompressionLevel 设置为 CompressionLevel.NoCompression 在 xamarin android 中不起作用

c# - 如何在android中创建一个选项菜单?

android - 无法使用 appcompat-v7 设置 navdrawer 以浏览新 5.0 SDK 中的工具栏