当我使用Android Studio构建我的应用程序时,我遇到了这个错误。APK被编译,但当我试图在Android P模拟器上运行应用程序时,它会崩溃并抛出以下错误。详情请见附件:

java.lang.NoClassDefFoundError:failed resolution of :Lorg/apache/http/ProtocolVersion

这是我的身材。级文件。如果有人对问题有什么建议,我将不胜感激。多谢。

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 "xxx.xxx.xxx"
        minSdkVersion 17
        targetSdkVersion 27
        versionCode xxxx
        versionName "Vx.x.x"

        multiDexEnabled true
     

     //other setting required
        ndk {
            abiFilters 'armeabi', 'armeabi-v7a', 'armeabi-v8a', 'x86', 'x86_64', 'mips', 'mips64'
        }