getSystemService(Context.NSD_SERVICE) freezes the 5.0 emulator
Asked Answered
A

1

2

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.

Anthill answered 3/12, 2014 at 20:49 Comment(1)
It gets stuck after running a few times successfully on a KitKat emulator. I have to reboot the emulator.Cota
A
3

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

Anthill answered 18/12, 2014 at 22:4 Comment(3)
Do you know if it is better now?Cota
Even if they've fixed it, existing 5.0 is still broken.Anthill
Thanks for the info. It looks like an OS issue, not a SDK issue. Am I right? Even though I am targeting a specific device, I may still want to avoid it.Cota

© 2022 - 2024 — McMap. All rights reserved.