本文介绍了Android的连接/网络配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个WebService在远程虚拟机上运行我公司的内部网络。

I have a WebService running in a remote VM inside my company's network.

我可以看到在地址栏中键入URL我的笔记本电脑使用Chrome JSON响应。(的http:// VMaddress /服务名称/

I can see the JSON response using Chrome on my laptop by typing the url in the address bar (http://VMaddress/servicename/).

不过,我不能使用Android模拟器做到这一点。我公司使用代理,我在这两个仿真器发射窗口和Android应用程序本身内部已经定义了。我可以连接到谷歌之类的东西,但我仍然无法连接到远程VM。

However, I cannot do this using the Android emulator. My company uses a proxy and I have already defined it in both the emulator launch window and inside the Android application itself. I can connect to Google and stuff, but I still cannot connect to the remote VM.

所以我的问题是:

如何在联网Android模拟器处理?我知道它定义了不同的IP为本地主机,但我不应该至少能够看到在模拟器浏览器的JSON响应(因为我定义的,让我来访问Internet的代理)?

How is networking handled in the Android emulator? I know it defines a different ip for localhost, but shouldn't I be able to at least see the JSON response in the emulator browser (since I defined the proxy that would allow me to access the Internet)?

不模拟器上我的笔记本电脑的连接上运行?

Doesn't the emulator run on my laptop's connection?

我同时使用模拟器浏览器和Android应用程序得到一个403禁止访问响应。

I get a 403 forbidden response using both the emulator browser and the Android application.

我也试过其他的WebService URL (<$c$c>http://api.geonames.org/citiesJSON?north=44.1&south=-9.9&east=-22.4&west=55.2&lang=de&username=demo)而我得到一个200响应code,所以我的应用程序正常访问互联网)。

I also tried another WebService URL (http://api.geonames.org/citiesJSON?north=44.1&south=-9.9&east=-22.4&west=55.2&lang=de&username=demo) and I get a 200 response code, so my application is correctly accessing the Internet).

在此先感谢

---编辑---

我四处探听我的连接设置在我的笔记本电脑,并进入代理服务器设置在Chrome我在代理服务器的虚拟机在我的服务器是一个例外。
删除该异常给了我同样的403禁止错误我在我的模拟器。

I snooped around in my connection settings in my laptop and going into the Proxy Settings in Chrome I had an exception in the proxy for the VM where my server is.Removing that exception gives me the same 403 forbidden error I have in my emulator.

如何申请相同的异常仿真器?

How can I apply the same exception to the emulator?

推荐答案

不知怎的,我成功地解决这一点。

Somehow I managed to "resolve" this.

我不能完全肯定这是什么原因,但我跟着。没有网络连接的情况,而仿真器必须启动。

I am not entirely sure this is the reason, but I followed these steps. The emulator must start while there is no network available.

我也有由我公司使用的选项启动菜单中设置的DNS服务器:
-dns服务器服务器1,服务器(在命令提示符中得到了 IPCONFIG / ALL 的值)。它不会没有这些设置为我工作。

I also have the DNS servers from my company set in the Launcher menu using the options:-dns-server server1,server2 (got the values from ipconfig /all in a command prompt). It will not work for me without these settings.

和我在模拟器中通过创建以下一个新的APN手动配置代理服务器。

and I configured the proxy manually in the emulator by creating a new APN following these steps.

这篇关于Android的连接/网络配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 07:06