小编duk*_*ing的帖子

java.lang.NoClassDefFoundError:解析失败:Lorg/apache/http/ProtocolVersion

当我使用Android Studio 3.1构建Android P的应用程序时,我遇到了这样的错误,可以制作apk,但是当我在Android P模拟器上使用它时,它会崩溃并抛出以下信息,更多细节请参见图片.

java.lang.NoClassDefFoundError:解析失败:Lorg/apache/http/ProtocolVersion

在此输入图像描述

App模块下的build.gradle的一部分在下面,有人见过这个吗?并给出一些建议?非常感谢.

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'

        }
Run Code Online (Sandbox Code Playgroud)

android google-maps gradle apache-httpcomponents android-9.0-pie

275
推荐指数
11
解决办法
8万
查看次数