Nsd Manager Android Crashing on 4.2.2
Asked Answered
Q

1

7

Discovering services results in a system crash. The type of discover I am trying is

"_http._tcp."

Here's the log.

D/NsdService(13310): Discover services
E/AndroidRuntime(13310): *** FATAL EXCEPTION IN SYSTEM PROCESS: NsdService
E/AndroidRuntime(13310): java.lang.NullPointerException
E/AndroidRuntime(13310): at com.android.server.NsdService$ClientInfo.access$1200(NsdService.java:801)
E/AndroidRuntime(13310):    at com.android.server.NsdService$NsdStateMachine$EnabledState.requestLimitReached(NsdService.java:244)
E/AndroidRuntime(13310):    at com.android.server.NsdService$NsdStateMachine$EnabledState.processMessage(NsdService.java:292)
E/AndroidRuntime(13310):    at com.android.internal.util.StateMachine$SmHandler.processMsg(StateMachine.java:905)
E/AndroidRuntime(13310):    at com.android.internal.util.StateMachine$SmHandler.handleMessage(StateMachine.java:760)
E/AndroidRuntime(13310):    at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(13310):    at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime(13310):    at android.os.HandlerThread.run(HandlerThread.java:60)

The code that I use for starting discovery is

NsdManager nsd = (NsdManager) getSystemService(Context.NSD_SERVICE);
nsd.discoverServices("_http._tcp.", NsdManager.PROTOCOL_DNS_SD, discoveryListener);

When I run, my phone restarts everytime. I guess this is a bug on Android 4.2.2

Quiroz answered 17/3, 2013 at 6:53 Comment(0)
A
6

I get it on my Nexus 7. Looks like it is already reported as a bug.

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

Attaint answered 13/4, 2013 at 15:48 Comment(2)
Best thing to do is to just use JmDns. It works with almost all Android devices going back to API 7 (probably earlier too).Attaint
JmDNS fails on Android 5. But NSD misbehaves, too.Trapeziform

© 2022 - 2024 — McMap. All rights reserved.