需要使用 Android Emulator 进行身份验证的代理
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/28380/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Proxy which requires authentication with Android Emulator
提问by Rich Lawrence
Has anybody managed to get the Android Emulator working behind a proxy which requires authentication?
有没有人设法让 Android 模拟器在需要身份验证的代理后面工作?
I've tried setting the -http-proxy argument to
我试过将 -http-proxy 参数设置为
http://DOMAIN/USERNAME:PASSWORD@IP:PORT
but am having no success.
但我没有成功。
I've tried following the docs to no avail. I've also tried the -verbose-proxy
setting but this no longer seems to exist.
我试过遵循文档无济于事。我也尝试过-verbose-proxy
设置,但这似乎不再存在。
Any pointers?
任何指针?
采纳答案by Sandeep Singh
I Managed to do it in the Adndroid 2.2 Emulator.
我设法在 Adndroid 2.2 模拟器中做到了。
Go to "Settings" -> "Wireless & Networks" -> "Mobile Networks" -> "Access Point Names" -> "Telkila"
Over there set the proxy host name in the property "Proxy" and the Proxy port in the property "Port"
在那里设置“代理”属性中的代理主机名和“端口”属性中的代理端口
回答by Deepak Sarda
It seems like SDK 1.5 onwards, the -http-proxy
flag also doesn't work. What did work for me is to boot the android image in the emulator and then once Android is running, go to Home > Menu > Settings > Wireless Controls > Mobile Networks > Access Point Names
and then setup the http proxy settings for the default access point.
似乎从 SDK 1.5 开始,该-http-proxy
标志也不起作用。对我有用的是在模拟器中启动 android 映像,然后在运行 Android 后,转到Home > Menu > Settings > Wireless Controls > Mobile Networks > Access Point Names
并设置默认接入点的 http 代理设置。
With the APN proxy settings in place, I can get the emulator's browser to surf the web. However, other stuff like Maps still doesn't work.
有了 APN 代理设置,我就可以让模拟器的浏览器在网上冲浪了。但是,其他诸如地图之类的东西仍然不起作用。
回答by Naseer
I remember having the same problem - After searching on the web, I found this solution - From the command line,
我记得有同样的问题 - 在网上搜索后,我找到了这个解决方案 - 从命令行,
1. > adb shell
2. # sqlite3 /data/data/com.android.providers.settings/databases/settings.db
3. sqlite> INSERT INTO system VALUES(99,'http_proxy', 'proxy:port');
4. sqlite>.exit
EDIT: Edited answer to reflect the latest version of Android.
编辑:编辑答案以反映最新版本的 Android。
回答by arnouf
Apparently this problems runs only with Android 2.x and Windows. There is a opened bug here : http://code.google.com/p/android/issues/detail?id=5508&q=emulator%20proxy&colspec=ID%20Type%20Status%20Owner%20Summary%20Stars
显然这个问题只在 Android 2.x 和 Windows 上运行。这里有一个打开的错误:http: //code.google.com/p/android/issues/detail?id=5508&q=emulator%20proxy&colspec=ID%20Type%20Status%20Owner%20Summary%20Stars
回答by Taranttini
Find the file
androidtool.cfg
atC:\Documents and Settings\YOUR USER NAME\.android\
Add this line:
http.proxyLogin=USER@PASSWORD
Save the file and try to open the Android SDK.
找到文件
androidtool.cfg
在C:\Documents and Settings\YOUR USER NAME\.android\
添加这一行:
http.proxyLogin=USER@PASSWORD
保存文件并尝试打开 Android SDK。
回答by Taranttini
For setting proxy server we need to set APNS setting. To do this:
为了设置代理服务器,我们需要设置 APNS 设置。去做这个:
- Go to Setting
- Go to wireless and networks
- Go to mobile networks
- Go to access point names. Use menu to add new apns
- Set Proxy = localhost
- Set Port = port that you are using to make proxy server, in my case it is 8989
- 进入设置
- 转到无线和网络
- 进入移动网络
- 转至接入点名称。使用菜单添加新的 apns
- 设置代理 = 本地主机
- 设置端口 = 您用来制作代理服务器的端口,在我的例子中是 8989
For setting Name and apn here is the link:
设置 Name 和 apn 这里是链接:
According to your sim card you can see the table
根据您的 SIM 卡,您可以看到表格
回答by Glenn85
This worked for me: http://code.google.com/p/android/issues/detail?id=5508#c39
Apparently there's a bug in the emulator that forces you to use the IP address of the proxy instead of the name...
这对我
有用:http: //code.google.com/p/android/issues/detail?
id = 5508#c39 显然模拟器中存在一个错误,迫使您使用代理的 IP 地址而不是名称...
回答by bindu
Using Android SDK 1.5 emulator with proxy in Eclipse 3.45
在 Eclipse 3.45 中使用带有代理的 Android SDK 1.5 模拟器
Go to Package Explorer -> Right click your Android project ->Run As->Run Configurations.
转到包资源管理器 -> 右键单击您的 Android 项目 -> 运行方式 -> 运行配置。
Under Android Application on the left column, select your project -> on the right column, where you see Android | Target | Common tabs ->
在左侧栏的 Android Application 下,选择您的项目 -> 在右侧栏中,您会看到 Android | 目标 | 常用标签 ->
Select Target -> on the bottom “Additional Emulator Command Line Options”->
选择 Target -> 在底部的“Additional Emulator Command Line Options”->
-http-proxy http://www.gateProxy.com:1080-debug-proxy http://www.gateProxy.com:1080
-http-proxy http://www.gateProxy.com:1080-debug-proxy http://www.gateProxy.com:1080
->Run/Close.
-> 运行/关闭。
回答by prasad
Start command prompt.
Go the folder where your emulator is located. In general, it will be in the tools folder of the Android SDK.
Then use the following command:
emulator -avd <avd name> -http-proxy <server>:<proxy>
By using this, we will be able to access the internet using the browser.
启动命令提示符。
转到模拟器所在的文件夹。一般来说,它会在Android SDK 的tools 文件夹中。
然后使用以下命令:
emulator -avd <avd name> -http-proxy <server>:<proxy>
通过使用它,我们将能够使用浏览器访问互联网。
回答by user280818
Jay, though that would be the ideal place for this information, it has not been updated for 2.1. Below I will list the methods that currently do NOT work for the 2.1 emulator.
Jay,虽然那将是提供此信息的理想位置,但它尚未针对 2.1 进行更新。下面我将列出目前不适用于 2.1 模拟器的方法。
The http-post argument does not work for the 2.1 emulator. Setting a proxy in the APN list within the 2.1 emulator does not work. Inserting the proxy directly into the system table via sql-lite does not work with 2.1.
http-post 参数不适用于 2.1 模拟器。在 2.1 模拟器中的 APN 列表中设置代理不起作用。通过 sql-lite 将代理直接插入系统表不适用于 2.1。
In fact, the ONLY way to get the browser to connect to the internet via the emulator that I've found in 2.1, is to NOT use a proxy at all. I really hope this gets fixed soon, for there are many people with this same problem.
事实上,让浏览器通过我在 2.1 中找到的模拟器连接到互联网的唯一方法是根本不使用代理。我真的希望这能尽快得到解决,因为有很多人有同样的问题。