开发者

Android can't see devices on ".local" domain

I'm having an annoying issue with Android development. I have a webserver (Tomcat) running on my Macbook which is connected to the local network via wifi. I have my Sprint EVO connected to the same network using wifi. The only way I can connect to the Tomcat ins开发者_Go百科tance is by raw IP address. If I use the Macbook name with or without the ".local" domain suffix it does not recognize the host name. The emulator behaves the same way. My iPhone can resolve the host name as can the iPhone simulator. So, I'm thinking either this is a bug in the Android platform or I've missed/accidentally tweak some hidden config somewhere in both the emulator and the device? Any idea?


A .local domain suggests Bonjour, which Android doesn't speak natively. The Mac's name without '.local' is either an AFP name or a WINS name (if you've got samba turned on), which isn't going to help much either.

You'll need to set up a proper DNS server (maybe your wifi router will do it), or try one of the java zeroconf libraries as described here.


More than 10 years after this question was asked, it has now been added to Android. You can visit a .local domain name (mDNS domain) - I have a raspberry pi server (raspberrypi.local) running a python web server (python3 -m http.server) in my screenshot.

From the android docs:

Users can use the command adb shell ping6 HOSTNAME.local, where HOSTNAME is the hostname of a target device on the LAN, for example, adb shell ping6 ipad.local.

Useful reading

  • Android docs
  • Higher level reading - also explains how Android devices were updated ("Mainline")

Android can't see devices on ".local" domain

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜