我收到了这个错误:
03-04 09:55:55.915: W/dalvikvm(20171): Exception Ljava/lang/NullPointerException; thrown while initializing La/a/b/k;
03-04 09:55:55.915: W/dalvikvm(20171): Exception Ljava/lang/ExceptionInInitializerError; thrown while initializing La/a/b/l;
03-04 09:55:55.925: W/dalvikvm(20171): threadid=13: thread exiting with uncaught exception (group=0x40ab3300)
03-04 09:55:55.945: E/AndroidRuntime(20171): FATAL EXCEPTION: AsyncTask #1
03-04 09:55:55.945: E/AndroidRuntime(20171): java.lang.RuntimeException: An error occured while executing doInBackground()
03-04 09:55:55.945: E/AndroidRuntime(20171): at android.os.AsyncTask$3.done(AsyncTask.java:299)
03-04 09:55:55.945: E/AndroidRuntime(20171): at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
03-04 09:55:55.945: E/AndroidRuntime(20171): at java.util.concurrent.FutureTask.setException(FutureTask.java:124)
03-04 09:55:55.945: E/AndroidRuntime(20171): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
03-04 09:55:55.945: E/AndroidRuntime(20171): at java.util.concurrent.FutureTask.run(FutureTask.java:137)
03-04 09:55:55.945: E/AndroidRuntime(20171): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
03-04 09:55:55.945: E/AndroidRuntime(20171): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
03-04 09:55:55.945: E/AndroidRuntime(20171): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
03-04 09:55:55.945: E/AndroidRuntime(20171): at java.lang.Thread.run(Thread.java:856) 03-04 09:55:55.945: E/AndroidRuntime(20171): Caused by: java.lang.ExceptionInInitializerError
03-04 09:55:55.945: E/AndroidRuntime(20171): at a.a.b.f.<init>(Unknown Source)
03-04 09:55:55.945: E/AndroidRuntime(20171): at a.a.b.e.<init>(Unknown Source)
03-04 09:55:55.945: E/AndroidRuntime(20171): at a.a.c.dh.b(Unknown Source)
03-04 09:55:55.945: E/AndroidRuntime(20171): at a.a.c.dh.a(Unknown Source)
03-04 09:55:55.945: E/AndroidRuntime(20171): at a.a.c.b.a(Unknown Source)
03-04 09:55:55.945: E/AndroidRuntime(20171): at a.a.c.ad.a(Unknown Source)
03-04 09:55:55.945: E/AndroidRuntime(20171): at a.a.a.a(Unknown Source)
03-04 09:55:55.945: E/AndroidRuntime(20171): at com.taco.bezoekerspasparkeren.c.a(Unknown Source)
03-04 09:55:55.945: E/AndroidRuntime(20171): at com.taco.bezoekerspasparkeren.c.doInBackground(Unknown Source)
03-04 09:55:55.945: E/AndroidRuntime(20171): at android.os.AsyncTask$2.call(AsyncTask.java:287)
03-04 09:55:55.945: E/AndroidRuntime(20171): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
03-04 09:55:55.945: E/AndroidRuntime(20171): ... 5 more
03-04 09:55:55.945: E/AndroidRuntime(20171): Caused by: java.lang.ExceptionInInitializerError
03-04 09:55:55.945: E/AndroidRuntime(20171): at a.a.b.l.<clinit>(Unknown Source)
03-04 09:55:55.945: E/AndroidRuntime(20171): ... 16 more
03-04 09:55:55.945: E/AndroidRuntime(20171): Caused by: java.lang.NullPointerException
03-04 09:55:55.945: E/AndroidRuntime(20171): at java.util.Properties.load(Properties.java:246)
03-04 09:55:55.945: E/AndroidRuntime(20171): at a.a.b.k.d(Unknown Source)
03-04 09:55:55.945: E/AndroidRuntime(20171): at a.a.b.k.<clinit>(Unknown Source)
03-04 09:55:55.945: E/AndroidRuntime(20171): ... 17 more
03-04 09:55:55.995: W/ActivityManager(265): Force finishing activity com.taco.bezoekerspasparkeren/.BezoekerspasActivity
使用这段代码:
class Subscribe extends AsyncTask<String, Void, Result> {
@Override
protected Result doInBackground(String... s) {
// ...
Document test = Jsoup.parse("<html></html>"); // explodes here
}
}
这仅适用于发布模式。我正在使用Jsoup 1.7.2。怎么了?我怎么能看到错误在“...... 17以上”中崩溃,因为我猜这里的线索就在那里......
这与error using AsyncTask only when running release apk... please help :(的问题相同,但没有答案。
这个让我好痛!
答案 0 :(得分:12)
这确实是ProGuard的一个混淆问题(如果只在发布模式中存在问题,这是合乎逻辑的),我不得不将以下内容添加到proguard文件中:
-keep public class org.jsoup.** {
public *;
}