java.lang.NoClassDefFoundError::Lorg/apache/http/ProtocolVersion的解析失败 [英] java.lang.NoClassDefFoundError:failed resolution of :Lorg/apache/http/ProtocolVersion

查看:300
本文介绍了java.lang.NoClassDefFoundError::Lorg/apache/http/ProtocolVersion的解析失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I 've met such error when I use Android studio 3.1 to build an Android P 's app, the apk can be made ,but when I use it on Android P emulator , it will crash and throw below info, more details see the pic.

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

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

部分在下面,有人满足吗?并提出一些建议?非常感谢.

part of my build.gradle under App module is below , anybody meet this ?And give some suggesstion ? Many thanks.

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'

        }

推荐答案

更新:这不再是bug或解决方法,如果您的应用程序的目标是API Level 28(Android 9.0)或以上版本,并使用适用于Android 16.0.0或更低版本的Google Maps SDK(或者如果您的应用使用Apache HTTP旧版库).现在,它已包含在官方文档中. 已根据预期行为已关闭.

这是Google Play服务方面的错误,直到修复为止,您应该可以通过将其添加到<application>标记内的AndroidManifest.xml中来解决:

This is a bug on the Google Play Services side, until it's fixed, you should be able to workaround by adding this to your AndroidManifest.xml inside the <application> tag:

<uses-library android:name="org.apache.http.legacy" android:required="false" />

这篇关于java.lang.NoClassDefFoundError::Lorg/apache/http/ProtocolVersion的解析失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆