Richard
Richard

Reputation: 71

Accessing intranet in Android emulator

I'm trying to test an intranet site in the Android emulator, but I can't seem to get the emulator to access our intranet. For example, the site I'm trying to access is at http://compass/messages, but trying that page in the browser gives me a Google search result page instead of the intranet site.

I can access the INTERNET with the emulator, but not the INTRANET. I can access the intranet from the host machine, and from the iPhone simulator on the same machine.

I'm assuming there's some sort of weird command line thing I need to do, but I'm pretty clueless...any ideas?

Upvotes: 7

Views: 6579

Answers (4)

Huscarter
Huscarter

Reputation: 1

I have solved this problem by following steps:

adb shell

set setprop net.dns 10.10.20.19(your pc's ip)

restart your emulator.

Upvotes: 0

Adrian Carr
Adrian Carr

Reputation: 3133

After a tremendous amount of searching with no answer, I was able to access my local dev server by substituting the domain with the ip address. For example, instead of:

http://compass/messages

use this (with your server's IP address)

http://172.33.22.1/messages

It works in the Android emulator browser, and also from a WebView in the app in the emulator. I don't know why this works, but it does for me. Hope it helps someone else.

Upvotes: 5

Pre101
Pre101

Reputation: 2370

I was having the same problem and I wasn't been able to find any solution anywhere. What I finally did (after playing around with port forwarding) was to use ssh to create a tunnel to the remote machine:

ssh -L 5555:localhost:5555 10.0.1.14

This should allow you to connect to the local machine's IP address in the emulator (10.0.2.2) and reach the other machine in your network (on the specified port).

If anyone has a better solution for accessing the local network from the android emulator I'd love to hear it.

Upvotes: 3

Vinay
Vinay

Reputation: 4783

Intranet site may require proxy.

You can set the proxy in Settings

Upvotes: 0

Related Questions