JSoup parsing not working in iOS module

Hello,

I am using JSoup to parse some webpage information for my android app. Now I am also implementing this to my iOS module. The problem is it is not properly parsing there. Networking is not the problem as I can easily print the downloaded html correctly out. The problem is when I call the parse method of JSoup: It throws an exception.

java.lang.NullPointerException: Attempt to invoke virtual method ‘int java.io.Reader.read(char[])’ on a null object reference

This is somewhere inside the JSoup library and seems not to be supported for use with the iOS system of the multi os engine. I can’t really exactly tell where the problem is as decompiling the library messes somehow the lines up and they no longer match those in the exception, but I am trying to find the root of the problem.

If anyone knows what might go on there, please share your ideas!

Thanks in advance
Mikis Wöhrmann

That is odd. I am using jsoup and it is working perfectly. The only issue is to make sure classes aren’t excluded by proguard.

@ekuleshov thank you for you reply, very appreciated!

Which version of moe are you using? I am on the 2.0 alpha build.

And what about Proguard? Never used it intentionally, what does it do? How do I access it and ensure classes aren’t excluded?

I am using 1.3 for production.
There are several posts on the forum about proguard configuration. On 1.3 it is part of standard moe build.

Thanks again.

But I just found out the problem was my jsoup version: I was still on 1.8.3 which somehow not works correctly with moe. I updated to 1.10.3 and it worked. Never had thought that this could be an issue. Really strange.

Anyway, thank you for you help!

EDIT

Actually: I am not yet done

Caused by: java.lang.IllegalStateException: Could not read resource entities-xhtml.properties. Make sure you copy resources for org.jsoup.nodes.Entities

This error occurs. I assume that pro guard is not keeping those properties files in the packages. How did you @ekuleshov solve this? The only thing I added to my proguard-rules.txt is the following:

-keeppackagenames org.jsoup.nodes

#push

Okay The error I posted above is just an error caused before my initial error, so still the java.lang.NullPointerException: Attempt to invoke virtual method ‘int java.io.Reader.read(char[])’ on a null object reference problem.

Anyone has got any ideas why this is happening? Or @ekuleshov could you send me the jar you are using? I actually also loaded the code as a module into my project so I could look for the error but it changes nothing. The error is just appearing on use with iOS. Android works just fine. I have no idea whats going on…

Thanks in advance
Mikis Wöhrmann

I’m using jsoup 1.9.2

Me too, very strange, I don’t get it. Maybe it’s something about moe 2.0; Have you used it on 2.0 yet?