运行代码时出现致命异常:AsyncTask #1。日志告诉我这是由 NoSuchMethodError 指向com.google.api.client.http.HttpHeaders.set
. 我正在使用适用于 Android 的 Factual java 驱动程序,并且在运行该代码时出现此错误。
为什么我会得到这个?我能做些什么来解决它?
这是错误指向的代码:
@Override
protected List<ReadResponse> doInBackground(Query... params) {
List<ReadResponse> results = Lists.newArrayList();
for (Query q : params) {
results.add(factual.fetch("restaurants-us", q));
}
return results;
}
我得到的错误日志在这里:
04-14 18:07:43.731: E/AndroidRuntime(12714): FATAL EXCEPTION: AsyncTask #1
04-14 18:07:43.731: E/AndroidRuntime(12714): java.lang.RuntimeException: An error occured while executing doInBackground()
04-14 18:07:43.731: E/AndroidRuntime(12714): at android.os.AsyncTask$3.done(AsyncTask.java:200)
04-14 18:07:43.731: E/AndroidRuntime(12714): at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:274)
04-14 18:07:43.731: E/AndroidRuntime(12714): at java.util.concurrent.FutureTask.setException(FutureTask.java:125)
04-14 18:07:43.731: E/AndroidRuntime(12714): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:308)
04-14 18:07:43.731: E/AndroidRuntime(12714): at java.util.concurrent.FutureTask.run(FutureTask.java:138)
04-14 18:07:43.731: E/AndroidRuntime(12714): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088)
04-14 18:07:43.731: E/AndroidRuntime(12714): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581)
04-14 18:07:43.731: E/AndroidRuntime(12714): at java.lang.Thread.run(Thread.java:1027)
04-14 18:07:43.731: E/AndroidRuntime(12714): Caused by: java.lang.NoSuchMethodError: com.google.api.client.http.HttpHeaders.set
04-14 18:07:43.731: E/AndroidRuntime(12714): at com.factual.driver.Factual.request(Factual.java:668)
04-14 18:07:43.731: E/AndroidRuntime(12714): at com.factual.driver.Factual.request(Factual.java:614)
04-14 18:07:43.731: E/AndroidRuntime(12714): at com.factual.driver.Factual.request(Factual.java:610)
04-14 18:07:43.731: E/AndroidRuntime(12714): at com.factual.driver.Factual.get(Factual.java:343)
04-14 18:07:43.731: E/AndroidRuntime(12714): at com.factual.driver.Factual.fetch(Factual.java:110)
04-14 18:07:43.731: E/AndroidRuntime(12714): at com.example.blobtag2.PlaceActivity$FactualRetrievalTask.doInBackground(PlaceActivity.java:139)
04-14 18:07:43.731: E/AndroidRuntime(12714): at com.example.blobtag2.PlaceActivity$FactualRetrievalTask.doInBackground(PlaceActivity.java:1)
04-14 18:07:43.731: E/AndroidRuntime(12714): at android.os.AsyncTask$2.call(AsyncTask.java:185)
04-14 18:07:43.731: E/AndroidRuntime(12714): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:306)
04-14 18:07:43.731: E/AndroidRuntime(12714): ... 4 more
非常感谢任何帮助,如果我能提供其他任何帮助,请告诉我。谢谢!