-1

Why I can't use HttpClient in Android Studio? my ADT:23, My SDK:24. Isn't it good to use HttpClient to replace HttpURLConnection?

Shree Krishna
  • 8,474
  • 6
  • 40
  • 68
Rose
  • 1
  • 2
  • 2
    read this: http://stackoverflow.com/questions/36354402/cannot-resolve-symbol-httpget-httpclient-defaulthttpclient-in-android-studio/36354461#36354461 – Rohit Arya Apr 03 '16 at 04:50

1 Answers1

3

Android 6.0 release removed support for the Apache HTTP client. If your app is using this client and targets Android 2.3 (API level 9) or higher, use the HttpURLConnection class instead. This API is more efficient because it reduces network use through transparent compression and response caching, and minimizes power consumption. To continue using the Apache HTTP APIs, you must first declare the following compile-time dependency in your build.gradle file:

useLibrary 'org.apache.http.legacy'

See here for more info.

Shree Krishna
  • 8,474
  • 6
  • 40
  • 68