首页 > 解决方案 > 没有 Lorg/apache/http/conn/ssl/AllowAllHostnameVerifier 类型的静态字段实例;

问题描述

java.lang.NoSuchFieldError: No static field INSTANCE of type Lorg/apache/http/conn/ssl/AllowAllHostnameVerifier; in class Lorg/apache/http/conn/ssl/AllowAllHostnameVerifier; or its superclasses (declaration of 'org.apache.http.conn.ssl.AllowAllHostnameVerifier' appears in /system/framework/framework.jar!classes2.dex)
    at org.apache.http.conn.ssl.SSLConnectionSocketFactory.<clinit>(SSLConnectionSocketFactory.java:146)
    at org.apache.http.impl.client.HttpClientBuilder.build(HttpClientBuilder.java:966)
    at com.example.mainui.cleorgpk.SpeechToText.mtdh01_conversion(SpeechToText.java:289)
    at com.example.mainui.Learning.lambda$viewListeners_Audio$3$Learning(Learning.java:177)

我尝试了根据 StackSite 处理它的所有其他方法但发现没有有效的解决方案我 的问题问题是我使用了下面给出的 Apache 的 HttpClient

  1. 实现 'org.apache.httpcomponents:httpcore:4.4.10'
  2. 实现 'org.apache.httpcomponents:httpclient:4.5.6'

implementation group: 'org.apache.httpcomponents' , name: 'httpclient-android' , version: '4.3.5.1' implementation('org.apache.httpcomponents:httpmime:4.5.6') { exclude module: 'httpclient' } implementation 'org.apache.httpcomponents:httpclient-android:4.3.5'

但他们根本没有帮助......一些帮助完整的信息

android {
compileSdkVersion 30
buildToolsVersion "30.0.2"
packagingOptions {
    exclude 'META-INF/DEPENDENCIES'
}

`

defaultConfig {
    applicationId "com.example.mainui"
    minSdkVersion 23
    targetSdkVersion 30
    versionCode 1
    versionName "1.0"

    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}`

标签: androidhttpclient

解决方案


推荐阅读