org.apache.http stops working in Android SDK 23

Issue

A project no longer compiles in Android Studio after switching from Android SDK v22 to v23. The compiler complains that it can not resolve symbol HttpClient, or that package org.apache.http does not exist.

Resolution

The issue is not an unexpected one. Apache HTTP Client was deprecated in SDK 22 and then completely removed in SDK 23. Google now suggest using HttpURLConnection class instead.

If you want to keep using org.apache.http, add following code to your build.gradle (in Android section):

useLibrary ‘org.apache.http.legacy’

Android Studio 1.5.1
Android SDK 23

 

 


Comments

Leave a Reply

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