Fixing The “Invalid use of SingleClientConnManager: connection still allocated” Problem

I came upon this problem because the site I wanted to access had server problems, meaning the website was down. When my code tried to access it again, it gave out this “Invalid use of SingleClientConnManager: connection still allocated” exception message.

My code uses Apache’s HttpClient 3rd party library and I thought at first calling the consumeContent() method of the HttpEntity class did the trick since I never even closed the InputStream when getting a reference to it. It did not.

Luckily, after much surfing I stumbled upon Jason Hudgin’s site where he created a convenience method that avoids this problem.

Related Posts Plugin for WordPress, Blogger...

6 comments

  1. Did the trick! I’m really amazed by this solution and i don’t even want to know how did its author figure it out, because it would probably blow my mind.

  2. Im getting this error too, but im noob in android and dont know how to use this method to solve the problem. Can someone explain? =D

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">