Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8739003
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:51:06+00:00 2026-06-13T10:51:06+00:00

maybe you can help me out. I’m working on an Android app project that

  • 0

maybe you can help me out. I’m working on an Android app project that calls on the Rotten Tomatoes API, which returns JSON data. But whenever I run my code the application crashes. The specific bit of code that’s giving me problems is httpClient.execute(httpPost);

The url string that’s being passed to the method is fine and returns the correct data when I type it in my browser, so I know that isn’t the problem. I’m kinda at a loss. I’ve never had an issue with an HttpClient, though in the past I’ve only worked with XML, never JSON.

I’ve been struggling with this for a while now. If anyone has any insight, it would be greatly appreciated.

 public JSONObject getJSON(String url) {
    //Make HTTP Request
    try {

        //defaultHttpClient
        DefaultHttpClient httpClient = new DefaultHttpClient();
        HttpPost httpPost = new HttpPost(url);
        //Log.d("RunTest", url);
        HttpResponse httpResponse = httpClient.execute(httpPost); // THIS LINE CAUSES APPLICATION TO CRASH
        HttpEntity httpEntity = httpResponse.getEntity();
        is = httpEntity.getContent();

    } catch (UnsupportedEncodingException uee) {
        Log.d("Exceptions", "UnsupportedEncodingException");
        uee.printStackTrace();
    } catch (ClientProtocolException cpe) {
        Log.d("Exceptions", "ClientProtocolException");
        cpe.printStackTrace();
    } catch (IOException ioe) {
        Log.d("Exceptions", "IOException");
        ioe.printStackTrace();
    }

10-27 02:52:44.484: I/Choreographer(627): Skipped 147 frames!  The application may be doing too much work on its main thread.
10-27 02:52:44.704: W/dalvikvm(627): threadid=12: thread exiting with uncaught exception (group=0x40a13300)
10-27 02:52:44.724: E/AndroidRuntime(627): FATAL EXCEPTION: AsyncTask #1
10-27 02:52:44.724: E/AndroidRuntime(627): java.lang.RuntimeException: An error occured while executing doInBackground()
10-27 02:52:44.724: E/AndroidRuntime(627):  at android.os.AsyncTask$3.done(AsyncTask.java:299)
10-27 02:52:44.724: E/AndroidRuntime(627):  at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
10-27 02:52:44.724: E/AndroidRuntime(627):  at java.util.concurrent.FutureTask.setException(FutureTask.java:124)
10-27 02:52:44.724: E/AndroidRuntime(627):  at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
10-27 02:52:44.724: E/AndroidRuntime(627):  at java.util.concurrent.FutureTask.run(FutureTask.java:137)
10-27 02:52:44.724: E/AndroidRuntime(627):  at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
10-27 02:52:44.724: E/AndroidRuntime(627):  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
10-27 02:52:44.724: E/AndroidRuntime(627):  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
10-27 02:52:44.724: E/AndroidRuntime(627):  at java.lang.Thread.run(Thread.java:856)
10-27 02:52:44.724: E/AndroidRuntime(627): Caused by: java.lang.IllegalStateException: Target host must not be null, or set in parameters. scheme=null, host=null, path=api.rottentomatoes.com/api/public/v1.0/lists/movies/box_office.json
10-27 02:52:44.724: E/AndroidRuntime(627):  at org.apache.http.impl.client.DefaultRequestDirector.determineRoute(DefaultRequestDirector.java:591)
10-27 02:52:44.724: E/AndroidRuntime(627):  at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:293)
10-27 02:52:44.724: E/AndroidRuntime(627):  at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
10-27 02:52:44.724: E/AndroidRuntime(627):  at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
10-27 02:52:44.724: E/AndroidRuntime(627):  at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)
10-27 02:52:44.724: E/AndroidRuntime(627):  at com.example.rottentomatoesclient.JSONParser.getJSON(JSONParser.java:39)
10-27 02:52:44.724: E/AndroidRuntime(627):  at com.example.rottentomatoesclient.MoviesActivity$getMovieList.doInBackground(MoviesActivity.java:90)
10-27 02:52:44.724: E/AndroidRuntime(627):  at com.example.rottentomatoesclient.MoviesActivity$getMovieList.doInBackground(MoviesActivity.java:1)
10-27 02:52:44.724: E/AndroidRuntime(627):  at android.os.AsyncTask$2.call(AsyncTask.java:287)
10-27 02:52:44.724: E/AndroidRuntime(627):  at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
10-27 02:52:44.724: E/AndroidRuntime(627):  ... 5 more
10-27 02:52:44.774: W/ActivityManager(148):   Force finishing activity com.example.rottentomatoesclient/.MoviesActivity
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T10:51:07+00:00Added an answer on June 13, 2026 at 10:51 am

    OK, your URL is probably not correct. In the middle of your long stack-trace you can find this:

    Caused by: java.lang.IllegalStateException: 
    Target host must not be null, or set in parameters. scheme=null, host=null,
    path=api.rottentomatoes.com/api/public/v1.0/lists/movies/box_office.json
    

    This looks like an error returned from the server – you did not supply all paramterers.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on asp.net (vb, maybe that can change something) I have a project
I have a little dilemma that maybe you can help me sort out. I've
Maybe there's someone out in the ether that can help me with this one.
I have a problem with preg_match_all that maybe you can help. I have a
need to implement a global error handling, so maybe you can help out with
Maybe someone can help me out. I have created a simple web user control,
I'm kind of rusty on my SQL, maybe you can help me out on
maybe anybody can help me out with a quite strange behaviour using hibernate and
Okay guys, maybe you can help me out with this one. I'm about ready
I remember reading somewhere (maybe someone can help remember where), that there is a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.