getSystemService(Context.NSD_SERVICE) freezes the 5.0 emulator

非 Y 不嫁゛ 提交于 2019-12-10 10:54:52

问题


Trying to execute the following line

NsdManager Mgr = (NsdManager)Ctxt.getSystemService(Context.NSD_SERVICE);

in the Android 5.0 emulator (ARMv7a, on Win64) freezes the emulator. The debugger never reaches the next line, the emulator doesn't respond to buttons, can be only closed.

Tried from both a background thread and from the main one. The context is an Activity.

Permissions in the manifest include:

  • android.permission.INTERNET
  • android.permission.ACCESS_WIFI_STATE
  • android.permission.CHANGE_WIFI_STATE
  • android.permission.CHANGE_WIFI_MULTICAST_STATE

The same line works as expected on a 4.4 emulator and on a 4.1 device. Any ideas what's different on 5.0 and/or what's wrong with the line, please? Did anybody try this on a 5.0 device?

EDIT: same on Intel emulator.


回答1:


NSD in Android is all kinds of broken. Don't even try to make it work, go back to JmDNS.

These are the damning bug reports:

https://code.google.com/p/android/issues/detail?id=35585 https://code.google.com/p/android/issues/detail?id=39750

Also, Nsd Manager Android Crashing on 4.2.2



来源:https://stackoverflow.com/questions/27281340/getsystemservicecontext-nsd-service-freezes-the-5-0-emulator

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!