Android9.0_P:ClassNotFoundException:Didn’t find class “org.apache.http.ProtocolVersion” on path:

Android9.0_P:ClassNotFoundException:Didn’t find class “org.apache.http.ProtocolVersion” on path:

今天在运行签名好的apk 在android9.0的小米8上面 出现打开闪退。
在 Android 6.0 中,我们取消了对 Apache HTTP 客户端的支持。 从 Android 9 开始,默认情况下该内容库已从 bootclasspath 中移除且不可用于应用。
    要继续使用 Apache HTTP 客户端,以 Android 9 及更高版本为目标的应用可以向其 AndroidManifest.xml的application节点下 添加以下内容:
<uses-library
    android:name="org.apache.http.legacy"
    android:required="false" />

 

在application下面添加 uses-library。即可

<application
            android:name=".MyApp"
            android:allowBackup="true"
            android:icon="@mipmap/ic_launcher"
            android:label="@string/app_name"
            android:roundIcon="@mipmap/ic_launcher_round"
            android:supportsRtl="true"
            android:theme="@style/AppTheme">

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

            <activity
                android:name=".activity.SplashActivity"
                android:exported="true"
                android:screenOrientation="portrait"
                android:theme="@style/Splash">
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />

                    <category android:name="android.intent.category.LAUNCHER" />
                    <category android:name="android.intent.category.DEFAULT" />
                </intent-filter>
            </activity>

        </application>

注:拥有最低 SDK 版本 23 或更低版本的应用需要 android:required=”false” 属性,因为在 API 级别低于 24 的设备上,org.apache.http.legacy 库不可用。 (在这些设备上,Apache HTTP 类在 bootclasspath 中提供。)

作为使用运行时 Apache 库的替代,应用可以在其 APK 中绑定自己的 org.apache.http 库版本。 如果进行此操作,您必须将该库重新打包(使用一个类似 Jar Jar 的实用程序)以避免运行时中提供的类存在类兼容性问题。

报错日志:

Failed resolution of: Lorg/apache/http/ProtocolVersion;
Didn’t find class “org.apache.http.ProtocolVersion” on path: DexPathList[[zip file “/data/app/xxx.xxx.xxx-w3A58rcDxu_HjNKhzjBcmQ==/base.apk”],nativeLibraryDirectories=[/data/app/com.gushenbei.android-w3A58rcDxu_HjNKhzjBcmQ==/lib/arm, /data/app/xxx.xxx.xxx-w3A58rcDxu_HjNKhzjBcmQ==/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib]]

 

同时如果你还有webView 的问题,我遇到并记录的如下

希望能解决您暂时的疑惑,纸上得来终觉浅,书到用时方恨少。共勉!

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/115036.html原文链接:https://javaforall.net

赞 (0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • Docker卸载_docker创建容器

    Docker卸载_docker创建容器Linux服务器Docker卸载某个镜像:首先输入命令dockerimages查看当前docker下有多少镜像:1[root@iZwz9a191mdam4di3dozk3Z~]#dockerimages2REPOSITORYTAGIMAGEIDCREATEDSIZE3mysql…

    2022年9月8日
  • tensorflow tensor转numpy

    tensorflow tensor转numpysess=tf.Session()withsess.as_default():change=tf.expand_dims(tf.reshape(batch_rodrigues((np.array(gt_data[‘pose_0’]).flatten()).reshape(-1,3).astype(np.float32)),(24,3,3)),0)gt_data[‘po.

    2022年10月19日
  • 如何查看/统计当前AD域控制器的活动用户

    如何查看/统计当前AD域控制器的活动用户

    2022年3月11日
  • python qt是什么_初识Python与Qt「建议收藏」

    python qt是什么_初识Python与Qt「建议收藏」Python的3.0版本,在开发阶段被称为Python3000,或简称Py3k。相对于Python的早期版本,这是一个较大的升级。为了不带入过多的累赘,Python3.0在设计的时候就没有考虑向下兼容。许多针对早期Python版本设计的程序都无法在Python3.0上正常运行。为了照顾现有程序,Python2.6作为一个过渡版本,基本使用了Python2.x的语法和库,同时考虑了向Pyt…

    2022年5月13日
  • app漏洞检测方法有哪些_安卓app漏洞挖掘

    app漏洞检测方法有哪些_安卓app漏洞挖掘根据国内专业PP漏洞检测平台爱内测(www.detect.cn)介绍,目前关于APP漏洞检测有以下6种功能检测方法: 组件安全检测对四大组件和WebView的规范使用检测分析,发现因为程序中不规范使用导致的组件漏洞。 代码安全检测对dex和so库以及第三方加载库的代码的安全处理进行检测分析,发现代码被反编译和激活成功教程的漏洞。 内存安全检测检测APP运行过程中的内存处理和保护机制进行检测分析…

    2022年10月28日
  • String类–深入理解

    String类–深入理解

    2021年8月28日

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号