0

This has now come to a point where I cannot take it anymore! i have seen a lot of people have had the same problem as this one but their solution do not work for me.

I am trying to call a REST service from my Android application. I am still new to Android BTW. The calling code looks like this:

String httpResult = "";
HttpClient httpClient = new DefaulthttpClient();
HttpContext httpContext = new BasicHttpContext();
String url = myURL;
HttpGet httpGet = new HttpGet(myURL);
HttpResponse response = httpClient.execute(httpGet, httpContext);

//receive response in input stream
InputStream is = response.getEntity().getContent();
//convert the stream into a string
if(is != null){
//call method that will convert stream to string
   httpResult = cString(is);
}else{
   httpResult = "Error";
}

When I debug the code, I see that throws an exception when the compiler hits the "HttpClient httpClient = new DefaultHttpClient()" line of code and shows "No Source Found" screen.

6
  • What's the exception? Commented Mar 3, 2014 at 9:33
  • 1
    Did you set in manifest.xml Internet permission? Commented Mar 3, 2014 at 9:33
  • <uses-permission android:name="android.permission.INTERNET" /> in manifest, near <application> tag Commented Mar 3, 2014 at 9:37
  • @Mach: the exception is class not found. Commented Mar 3, 2014 at 10:23
  • @user974801: Yes I already did that Commented Mar 3, 2014 at 10:23

1 Answer 1

1

"No Source Found"occurred when you debug a class without the source file.

You should just use F6 to step over when debugging.

Sign up to request clarification or add additional context in comments.

3 Comments

Okay then where do I find the source file for class "org.apache.http.impl.client.DefaultHttpClient" because I think this what it cannot resolve
Get the android sdk source and import it to eclipse. You can get it by Android SDK Manager(find the correct version and select the "Sources for Android SDK" item)
I used F6 to step over the code and it turns out twas the XML serialiser that was giving me issues. So i just changed my REST service to return JSON instead and now ALL WORKS WELL!!! yeeeeeeeepi! :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.