This question does sound strange, but I never experienced this before. I'm working on network printer application and use NsdManager to discover printers in the WiFi network. It had been working fine for last two weeks, discovering and resolving printers in the same WiFi network. But all of a sudden I started getting the following exception every time I initiate discovery:
06-03 15:38:07.351: ERROR/AndroidRuntime(16849): FATAL EXCEPTION: NsdManager
java.lang.NullPointerException
at android.net.nsd.NsdManager$ServiceHandler.handleMessage(NsdManager.java:328)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.os.HandlerThread.run(HandlerThread.java:60)
I'm testing app on Nexus S. I connected Samsung S3 and I don't get this error there. I've searched for this issue, but I couldn't find any workarounds. The closest I got is https://code.google.com/p/android/issues/detail?id=39583
Can anybody suggest a solution for this? I tried to change "_ipp._tcp" to "_ipp._udp", but it doesn't let me find any printers in the network.
来源:https://stackoverflow.com/questions/16907102/android-network-printers-discovery-nullpointerexception