美文网首页
java.lang.NoClassDefFoundError:f

java.lang.NoClassDefFoundError:f

作者: 阿闯学长 | 来源:发表于2019-03-05 11:30 被阅读8次

在华为荣耀10手机上,运行APP报错java.lang.NoClassDefFoundError:failed resolution of :Lorg/apache/http/ProtocolVersion

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

或者

java.lang.RuntimeException: Stub!
  at org.apache.http.message.BasicNameValuePair.<init>(BasicNameValuePair.java:6)
image.png
问题分析:
出现此问题主要是 apache 的 http 库在android 9.0删除导致的,出现此问题应该是使用了 apache 的http库。

修改建议:
尽量不要再使用httpClient来访问网络,替换成HttpURLConnection或者OKHttp。最后再说明一下:尽量不要使用过时的库进行开发。

在AndroidManifest.xml文件的application标签里面加入

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

就可以解决了!

相关文章

网友评论

      本文标题:java.lang.NoClassDefFoundError:f

      本文链接:https://www.haomeiwen.com/subject/xgjnuqtx.html