Q:

Android Gradle Unable to Find Apache Library

When I try to sync gradle, it shows this error.
Warning:Unable to find optional library: org.apache.http.legacy

My build.gradle:
android {
   compileSdkVersion 23
   buildToolsVersion "23.0.1"
   useLibrary 'org.apache.http.legacy'

defaultConfig {
    applicationId "com.myapp.mynamespace"
    minSdkVersion 15
    targetSdkVersion 23
    versionCode 17
    versionName "1.7"
    multiDexEnabled true
}

buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
    }
}

   compileOptions.encoding = 'UTF-8'
}

My root build.gradle:
buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.3.0'
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

I tried to use gradle 1.3.1 and buildToolsVersion 23.0.2 but it didn't work. There aren't many questions like this and they didn't resolved out. So I needed to ask this question to come to a fine end.

A:

I had this problem before and the way I solved it was by copying the JAR into the libs/ folder of your project, Gradle will not resolve this jar automatically.  
You should have a copy in your local machine already under SDK/platforms/android-23/optional

