title: java.lang.NoClassDefFoundError:failed resolution of :Lorg/apache/http/ProtocolVersion
body: <p>I'm encountering this error when I use Android Studio to build my app. The APK is compiled, but when I attempt to run the app on Android P emulator, it will crash and throw the following error. Please see more details in the attachments:</p>
  <pre><code>java.lang.NoClassDefFoundError:failed resolution of :Lorg/apache/http/ProtocolVersion
  </code></pre>
  <p><img src="https://i.stack.imgur.com/bMt0i.png" alt="enter image description here" /></p>
  <p>This is my build.grade file. If anybody has a suggestion on what the problem could be, I would appreciate it. Many thanks.</p>
  <pre><code>android {
  
       compileSdkVersion 'android-P'
       buildToolsVersion '28-rc1'
     
      useLibrary 'org.apache.http.legacy'
  
      //for Lambda
      compileOptions {
          targetCompatibility JavaVersion.VERSION_1_8
          sourceCompatibility JavaVersion.VERSION_1_8
      }
  
      packagingOptions {
  
          exclude 'META-INF/LICENSE'
          exclude 'META-INF/NOTICE'
      }
      defaultConfig {
          applicationId &quot;xxx.xxx.xxx&quot;
          minSdkVersion 17
          targetSdkVersion 27
          versionCode xxxx
          versionName &quot;Vx.x.x&quot;
  
          multiDexEnabled true
       
  
       //other setting required
          ndk {
              abiFilters 'armeabi', 'armeabi-v7a', 'armeabi-v8a', 'x86', 'x86_64', 'mips', 'mips64'
          }
  </code></pre>