2

I am getting a Fatal Exception: AsyncTask #1 when I run my code. The log is tell me that it's caused by a NoSuchMethodError pointing to com.google.api.client.http.HttpHeaders.set. I am using the Factual java driver for Android, and I am getting this error when that code is run.

Why am I getting this? What can I do to resolve it?

Here is the code that the error points to:

    @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;
    }

The error log that I am getting is here:

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

Any help is greatly appreciated, please let me know if I can provide anything else. Thanks!

user2163853
  • 889
  • 4
  • 14
  • 24

1 Answers1

0

It looks like your library Factual is calling a function that doesn't exist. Are you sure it works on your version of Android?

Gabe Sechan
  • 77,740
  • 9
  • 79
  • 113
  • I don't think I have any reason to believe it doesn't. I'm using the latest version of Android, and the latest version of the Factual library... – user2163853 Apr 15 '13 at 03:51
  • Check out this link http://stackoverflow.com/questions/5407250/causes-of-java-lang-nosuchmethoderror-main-exception-in-thread-main – Gabe Sechan Apr 15 '13 at 03:56
  • I understand that a method that doesn't exist is being called, but what I don't understand is why that's happening. Could it be because I am missing dependencies for the Factual library or have the wrong versions of specific dependencies? What else could be bringing it about? What I gather from that link is that the library could be missing the main() method, but I'm not sure why that applies? – user2163853 Apr 15 '13 at 04:02
  • @user2163853 is the library Factual a library project? If so you hsoul be doing something similar to the one in the link http://stackoverflow.com/questions/16003396/import-r-cannot-be-resolved-when-i-import-actionbarsherlock/16003930#16003930 – Raghunandan Apr 15 '13 at 05:56