Questions tagged [androidhttpclient]

Implementation of the Apache DefaultHttpClient that is configured with reasonable default settings and registered schemes for Android This class was deprecated in API level 22 (Android 5.1). Please use URLConnection and friends instead. The Apache HTTP client is no longer maintained and may be removed in a future release. Please visit this webpage for further details.

Implementation of the Apache DefaultHttpClient that is configured with reasonable default settings and registered schemes for Android.

Warning: This class was deprecated in API level 22 (Android 5.1).
Please use URLConnection and friends instead. The Apache HTTP client is no longer maintained and may be removed in a future release. Please visit this webpage for further details.

Useful links

418 questions
396
votes
12 answers

Make an HTTP request with android

I have searched everywhere but I couldn't find my answer, is there a way to make a simple HTTP request? I want to request a PHP page / script on one of my websites but I don't want to show the webpage. If possible I even want to do it in the…
Mats Hofman
  • 7,060
  • 6
  • 33
  • 48
373
votes
7 answers

How do you connect localhost in the Android emulator?

I have made a php script inside localhost and I am connecting that with httpClient but I am getting a problem. Please tell me how can I connect to a php file at localhost from the emulator?
Dharmendra
  • 33,296
  • 22
  • 86
  • 129
198
votes
13 answers

POST Multipart Form Data using Retrofit 2.0 including image

I am trying to do a HTTP POST to server using Retrofit 2.0 MediaType MEDIA_TYPE_TEXT = MediaType.parse("text/plain"); MediaType MEDIA_TYPE_IMAGE = MediaType.parse("image/*"); ByteArrayOutputStream byteArrayOutputStream = new…
JayVDiyk
  • 4,277
  • 22
  • 70
  • 135
33
votes
7 answers

Retrofit 2.0-beta-2 is adding literal quotes to MultiPart values

Went to upgrade to Retrofit 2.0 and running into this weird problem. I have a method to log a user in public interface ApiInterface { @Multipart @POST("user/login/") Call userLogin(@Part("username") String username,…
Brian
  • 4,328
  • 13
  • 58
  • 103
29
votes
6 answers

Getting NoSuchFieldError INSTANCE org/apache/http/message/BasicHeaderValueParser

I'm working on an app on Android. I'm using httpcore 4.3.3. I get this when I try to use ContentType.parse(string) java.lang.NoSuchFieldError: No static field INSTANCE of type Lorg/apache/http/message/BasicHeaderValueParser; in class…
joshkendrick
  • 3,497
  • 8
  • 38
  • 52
23
votes
2 answers

POST with Android Retrofit

I'm new to Android programming and working with Retrofit. I've done a bunch of research on this topic, but haven't been able to find a solution specific to my needs. I'm working with our API and trying to make a POST request. I successfully achieved…
22
votes
3 answers

OKhttp PUT example

My requirement is to use PUT, send a header and a body to server which will update something in the database. I just read okHttp documentation and I was trying to use their POST example but it doesn't work for my use case (I think it might be…
user5812467
20
votes
1 answer

Why should I use OkHttp instead of android httpClient and AsyncTask

In the presentation of Paresh Mayani at SpeakerDeck (https://speakerdeck.com/pareshmayani/lazy-android-developers-be-productive) he says that it's better to use OkHttp or Retrofit instead of AsyncTask with DefaultHttpClient. My question is why? Why…
RCB
  • 2,253
  • 2
  • 25
  • 49
20
votes
5 answers

Android Error: java.net.SocketException: Socket closed

I'm seeing this error come up in my crash logs hundreds of times a week but I have spent at this point several weeks trying to chase down the error without any success. I have been unable to reproduce it on any of my devices. Here's the stack…
D-Nice
  • 4,772
  • 14
  • 52
  • 86
19
votes
4 answers

The import org.apache.http.client cannot be resolved error when I update sdk to M

I am getting following errors when I import project into eclipse. I have updated my sdk to M. import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.HttpVersion; import org.apache.http.NameValuePair; import…
benarjee bojja
  • 348
  • 1
  • 3
  • 15
18
votes
6 answers

failed to connect to localhost/127.0.0.1 android

I am new to android development, and trying to call local .NET web api service in android via retrofit library. After starting my web api on IIS I am getting this error failed to connect to localhost/127.0.0.1 android. When I did same thing as…
Keval Patel
  • 925
  • 4
  • 24
  • 46
18
votes
4 answers

Android - MultipartEntity and dependencies

I recently migrate my project from Eclipse to Android Studio (I do not fully control this IDE yet). In this project, I have a file uploader AsyncTask which send multipart over http. To do this, I use org.apache.httpcomponents. I created following…
alex
  • 5,661
  • 6
  • 33
  • 54
18
votes
3 answers

Why does android get the wrong ssl certificate? (two domains, one server)

I have two domains: foo.net and bar.com. They both have SSL certificates, and they work well in all desktop and mobile browsers. They are hosted on the same server configured with nginx. However, when I make a request to a domain from within a…
hughes
  • 5,595
  • 3
  • 39
  • 55
13
votes
3 answers

Google Volley vs Android-Async-Http

I am looking into both these Android Http Networking libraries. I would like some peoples experiences with using the two libraries. Personally I have always used the http://loopj.com/android-async-http/ library quite happily. But it was recently…
Zapnologica
  • 22,170
  • 44
  • 158
  • 253
12
votes
1 answer

AndroidHttpClient versus HttpUrlConnection for API Level 9 and above

Which is better for API Level 9(Gingerbread) and why? Is there any benefit to use AndroidHttpClient over HttpUrlConnection? Any help or guidance will be well appreciated.
abhishek kumar gupta
  • 2,189
  • 6
  • 35
  • 56
1
2 3
27 28