代码在电脑上 Eclipse 正常编译运行,但是在 Android 上用 AIDE 编译运行后会出现
java.lang.ExceptionInInitializerError
at org.jsoup.nodes.Document$OutputSettings.(Document.java:373)
at org.jsoup.nodes.Document.(Document.java:18)
at org.jsoup.parser.TreeBuilder.initialiseParse(TreeBuilder.java:29)
at org.jsoup.parser.TreeBuilder.parse(TreeBuilder.java:42)
at org.jsoup.parser.HtmlTreeBuilder.parse(HtmlTreeBuilder.java:53)
at org.jsoup.parser.Parser.parseInput(Parser.java:30)
at org.jsoup.helper.DataUtil.parseByteData(DataUtil.java:132)
at org.jsoup.helper.HttpConnection$Response.parse(HttpConnection.java:596)
at org.jsoup.helper.HttpConnection.get(HttpConnection.java:195)
at Main.main(Main.java:16) at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.aide.ui.build.java.RunJavaActivity$1.run(SourceFile:108)
at java.lang.Thread.run(Thread.java:856)
Caused by: java.lang.ExceptionInInitializerError
at org.jsoup.nodes.Entities$EscapeMode.(Entities.java:19)
... 14 more
Caused by: java.lang.NullPointerException
at java.util.Properties.load(Properties.java:246)
at org.jsoup.nodes.Entities.loadEntities(Entities.java:235)
at org.jsoup.nodes.Entities.(Entities.java:219)
... 15 more
其中 Main.java:16 是
Document doc = Jsoup.connect("http://www.oxforddictionaries.com/definition/american_english/hat").get();
引用 Jsoup 的方法是在工程根目录下建了个 libs,然后把 Jsoup.jar 放进去,在 AIDE 里长按 jar,选 Add library to project。还有这不是 Android project 就是个普通的 Java project。
Google 过,找到的答案似乎都不行。求帮助QAQ