问题
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
回答1:
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
来源:https://stackoverflow.com/questions/15458323/nsd-manager-android-crashing-on-4-2-2