Android JSOUP ExceptionInInitializerError

时间:2016-11-20 12:11:11

标签: android jsoup

我使用amigo库更新了我的dex类(它正在为另一个apk更改一个apk,使用相同的密钥和签名,除了JSOUP之外一切正常工作)

错误:

  

致命异常:Thread-1567                                                      处理:com.smedic.tubtub,PID:26102                                                      java.lang.ExceptionInInitializerError                                                          在org.jsoup.nodes.Document $ OutputSettings。(Document.java:372)                                                          在org.jsoup.nodes.Document。(Document.java:19)                                                          在org.jsoup.parser.TreeBuilder.initialiseParse(TreeBuilder.java:32)                                                          在org.jsoup.parser.TreeBuilder.parse(TreeBuilder.java:42)                                                          在org.jsoup.parser.HtmlTreeBuilder.parse(HtmlTreeBuilder.java:56)                                                          在org.jsoup.parser.Parser.parseInput(Parser.java:32)                                                          在org.jsoup.helper.DataUtil.parseByteData(DataUtil.java:104)                                                          at org.jsoup.helper.HttpConnection $ Response.parse(HttpConnection.java:666)                                                          在org.jsoup.helper.HttpConnection.get(HttpConnection.java:225)                                                          在com.power.mati.VideosAdapter $ 4.run(VideosAdapter.java:177)                                                          在java.lang.Thread.run(Thread.java:818)                                                       引起:java.lang.IllegalStateException:无法读取资源   entities-xhtml.properties。确保复制资源   org.jsoup.nodes.Entities                                                          在org.jsoup.nodes.Entities.load(Entities.java:289)                                                          在org.jsoup.nodes.Entities.access $ 000(Entities.java:25)                                                          在org.jsoup.nodes.Entities $ EscapeMode。(Entities.java:48)

知道怎么解决吗?

我正在使用罐子和maven,情况相同。

5 个答案:

答案 0 :(得分:17)

我看到类似的东西,我的解决方案是在proguard

-keep class org.jsoup.**

答案 1 :(得分:2)

更新库,使用这个:

实现'org.jsoup:jsoup:1.13.1'

您的问题将得到解决...

答案 2 :(得分:0)

您是否正在使用proguard进行代码收缩?尝试禁用proguard并查看是否能解决此崩溃问题。

答案 3 :(得分:0)

在libs文件夹中添加Jsoup库,并在proguard-rules.pro文件中添加-keep类org.jsoup。**。

然后它将起作用。

答案 4 :(得分:-1)

对于我来说,我的问题是通过在应用程序的build.gradle中将minifyEnabled设置为false来解决的,这会将所有类保留在最终发行版apk中。

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

        }
    }
}