Android network printers discovery: NullPointerException

限于喜欢 提交于 2019-12-22 08:23:08

问题


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

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