Android JSOUP ExceptionInInitializerError

核能气质少年 提交于 2020-03-17 11:09:07

问题


I updated my dex classes with amigo library (it's changing one apk for another apk with the same key and signature, all is working except JSOUP)

Error:

FATAL EXCEPTION: Thread-1567 Process: com.smedic.tubtub, PID: 26102 java.lang.ExceptionInInitializerError at org.jsoup.nodes.Document$OutputSettings.(Document.java:372) at org.jsoup.nodes.Document.(Document.java:19) at org.jsoup.parser.TreeBuilder.initialiseParse(TreeBuilder.java:32) at org.jsoup.parser.TreeBuilder.parse(TreeBuilder.java:42) at org.jsoup.parser.HtmlTreeBuilder.parse(HtmlTreeBuilder.java:56) at org.jsoup.parser.Parser.parseInput(Parser.java:32) at org.jsoup.helper.DataUtil.parseByteData(DataUtil.java:104) at org.jsoup.helper.HttpConnection$Response.parse(HttpConnection.java:666) at org.jsoup.helper.HttpConnection.get(HttpConnection.java:225) at com.power.mati.VideosAdapter$4.run(VideosAdapter.java:177) at java.lang.Thread.run(Thread.java:818) Caused by: java.lang.IllegalStateException: Could not read resource entities-xhtml.properties. Make sure you copy resources for org.jsoup.nodes.Entities at org.jsoup.nodes.Entities.load(Entities.java:289) at org.jsoup.nodes.Entities.access$000(Entities.java:25) at org.jsoup.nodes.Entities$EscapeMode.(Entities.java:48)

Any idea how to fix it?

I am using jars and maven, same situation.


回答1:


I saw something similar and my solution is in proguard

-keep class org.jsoup.**



回答2:


Are you using proguard for code shrinking? Try to disable the proguard and see if that resolves this crash.




回答3:


in my case, my problem is solved by turning minifyEnabled to false in the app's build.gradle, this will keep all classes in the final release apk.

android {
....
    buildTypes {
...
        release {
            minifyEnabled false

        }
    }
}


来源:https://stackoverflow.com/questions/40703857/android-jsoup-exceptionininitializererror

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