RaBu.dk - Website and weblog of Rasmus Burkal

What is localhost at the Android Emulator?

Posted on the 20.03.2010 at 21:05 by Rasmus Burkal

I have recently been playing around with some web development, targeting touch phones on the mobile web. For testing I fired you up my local iPhone simulator and Android emulator, launched the default browsers and tried to access localhost/127.0.0.1, to verify the progress of my development. In the iPhone simulator Safari served localhost/127.0.0.1 with a charm, but the browser on the Android emulator didn’t like it at all!

Since the Android emulator is simulating the entire underlying Linux based OS, localhost/127.0.0.1 is already used internally on the Android emulator, so for you being able to access the webapp at your localhost/127.0.0.1, you must replace localhost/127.0.0.1 with 10.0.2.2!

So all in all:
localhost/127.0.0.1 at the Android emulator = 10.0.2.2

Bookmark and Share

Comments

Casper Helenius
Commented on the 14.04.2010 at 07:37

Does this go for the actual devices, too?


Leave a reply

To leave a reply, you must be logged in.