我正在开发 Android 上的应用程序。我正在使用httpcore 4.3.3。当我尝试使用时我得到这个ContentType.parse(string)
java.lang.NoSuchFieldError: No static field INSTANCE of type Lorg/apache/http/message/BasicHeaderValueParser; in class Lorg/apache/http/message/BasicHeaderValueParser; or its superclasses (declaration of 'org.apache.http.message.BasicHeaderValueParser' appears in /system/framework/ext.jar)
我做了一些谷歌搜索,我明白为什么我会收到错误,但我不确定如何修复它。从我读到的内容来看,ContentType 似乎试图利用 Android 附带的 BasicHeaderValueParser,并且该类还没有 INSTANCE 字段。有什么帮助吗?
这些是相关的进口:
compile('org.apache.httpcomponents:httpmime:4.3.6') {
exclude module: 'httpclient'
}
compile 'org.apache.httpcomponents:httpcore:4.3.3'
不幸的是,HttpCore 的库存版本无法在 Android 中使用。请用Apache HttpClient Android 端口其中还包括必需的 HttpCore 类
compile('org.apache.httpcomponents:httpmime:4.3.6') {
exclude module: 'httpclient'
}
compile 'org.apache.httpcomponents:httpclient-android:4.3.5'
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)