Home Features Docs Blog Support GitHub

JSoup not working in 2.0.0-alpha-1

I’ve tested it. For some reason JSoup doesn’t work on the 2.0.0-aplha-1. On 1.3 it does just wonderful.

The error I am getting from the console is the following:

Caused by: java.lang.NullPointerException: Attempt to invoke virtual method ‘int java.io.Reader.read(char[])’ on a null object reference
at java.util.Properties$LineReader.readLine(Properties.java:435)
at java.util.Properties.load0(Properties.java:354)
at java.util.Properties.load(Properties.java:342)
at org.jsoup.nodes.Entities.loadEntities(Entities.java:236)
at org.jsoup.nodes.Entities.(Entities.java:220)

I have no idea why this happens in 2.0. Maybe it’s about the new ClassLoading-Logic or something similar. But it seems like a problem in some internal java classes, but I can’t find the core source of that. I just wanted to let you know so you can keep an eye on that during development.

You can easily try it yourself

  1. Add the lib to your class path
  2. Get your certificates working
  3. Call some kind of parsing e.g.: Jsoup.connect(“https://google.com”).get();
  4. See multi os engine output

Good Luck finding the cause! I hope it gets fixed soon.


Tested JSOUP Versions:

  • 1.8.3
  • 1.9.2
  • 1.10.3 -> Had to fix something about a new resource file, but afterwards the same error appeared.


thanks for the report. Which version of JSoup did you test?

Best Regards,

@kisg edited my post.

I just hit the same issue with regular android project (no MOE). The proguard renamed org.jsoup.nodes.Entities class (or its package), so jsoup couldn’t find entities-base.properties or entities-full.properties. Solution is to keep package org.jsoup.nodes not renamed and make sure those property files are still there after proguard. Though I’m not sure how to check that in the MOE build…

@ekuleshov does that cause the exception above? Or was it just the exception message from jsoup about not finding the resources? Because if what you say is true, I might now be able to finish my project in time, which would be amazing.

First of all, thank you for sharing you experience. Now, could you explain me how you set up pro guard not to rename the package?

Error is caused by properties file not being there. Try to add this to proguard config:

-keep class org.jsoup.** { *; }

There might be a more optimal config, but you could start from that.

Sorry for disturbing again, but I was yet never able to edit my pro guard settings. I have added the line to the .pro file of the android module and in the project root directory I created a file called “proguard.append.cfg” where I also added the line but it seems to have no effect. What is also strange is that it is working on 1.3 but on 2.0.0-aplha-1 not. So are you sure this is pro guard?

How does your gradle build file look like and your proguard config?
There is a proguard trace file somewhere insude build/moe folders, you could check what is actually being processed.


This is the configuration.pro in the build folder: https://pastebin.com/BMakf9Ah
This is my grade build file of the iOS module: https://pastebin.com/TgUvDjxP

In my “proguard.append.cfg” in the project root I only added the line you recommended above. Which has obviously no effect. I also took a look into the ProGuard.log in the build folder: It documents what files it kept, and the properties files weren’t listed so I assume another proof my pro guard setup is wrong.

For the giggles. Have you tried to comment out proguardLevel 'app' or change it to ‘none’?
I have proguard.append.cfg in the ios module root and you can see trace of proguard in the /{module}-ios/build/moe/main/proguard/ProGuard.log

I am completely confused. Now there is no longer the output ProGuard.log file like before. After I removed / changed the proguardLevel nothing changed. Always the same problem. The old ProGuard logs kept everything from org.json except the properties files… I don’t know. For some reason I screwed up my Proguard completely. It seems like I have no influence on ProGuard at all. Is there a way to restore it. Or at least test, if I can address ProGuard. Because right now I feel like I have no control. And that does not feel good.

Is it maybe important to mention that I have a special module structure? See:

SpecialUnitApi Module
- uses a JSON lib (added as jar)

WebAccess Module
- uses JSoup added in gradle file (compile ‘org.jsoup:jsoup:1.10.3’)
- uses SpecialUnitApi Module

iOS Module
- uses WebAccess Module

Android Module
- uses WebAccess Module


Now I have an Idea: since it is working on 1.3, I think it is something about 2.0 alpha and ProGuard. For some reason Proguard does not work properly (or at least not like 1.3) on 2.0.0-alpha-1. Maybe someone from the Devs knows something about it. Did they change the way you address ProGuard / you use it?

@ekuleshov I would really appreciate you trying JSoup on moe 2.0.0-alpha-1 to confirm my theory. As I have no other machine to test it on.