bitletorg / weupnp

A tiny UPnP (Universal Plug and Play) client library written in Java
http://bitletorg.github.io/weupnp
100 stars 36 forks source link

Don't work on android #20

Open MaximeLimone opened 8 years ago

MaximeLimone commented 8 years ago

Hello,

Your work is fabulous !!! But it don't work on android for me, weupnp never find the gateway... Moto X Pure - Android 6.0

a-pavlov commented 8 years ago

Hi, I had similar problem and after add printing stack traces found out it related to: From adb output: Can't create default XMLReader; is system property org.xml.sax.driver set? To fix you have to explicitly create factory: SAXParserFactory saxParserFactory = SAXParserFactory.newInstance(); SAXParser newSAXParser = saxParserFactory.newSAXParser(); XMLReader parser = newSAXParser.getXMLReader(); Instead of XMLReader parser = XMLReaderFactory.createXMLReader(); Will prepare fix soon.

abahgat commented 8 years ago

Thank you @a-pavlov! Can you confirm the fix will work also on non-android systems?

a-pavlov commented 8 years ago

Hi @abahgat , it definitely works on Windows. I've created pull request with fix.

ghost commented 7 years ago

Hi, you should specify the Sax driver by using:

System.setProperty("org.xml.sax.driver", "org.xmlpull.v1.sax2.Driver");

this way it is working with no modification to the original code. Thanks.

frikksol commented 6 years ago

I can confirm that the fix by @ghost works on Android. I have not tested on other systems