使用Android Studio在Java中尝试设置S3Client.builder()时,收到AllowAllHostnameVerifier的NoSuchFieldError。

0 人关注

This code:

S3Client sS3Client = S3Client.builder()
                    .region(region)
                    .credentialsProvider(credentialsProvider)
                    .build();

在Android Studio中产生了以下错误。

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!classes4.dex)    
    at org.apache.http.conn.ssl.SSLConnectionSocketFactory.<clinit>(SSLConnectionSocketFactory.java:151)
    at software.amazon.awssdk.http.apache.ApacheHttpClient$ApacheConnectionManagerFactory.getPreferredSocketFactory(ApacheHttpClient.java:658)
    at software.amazon.awssdk.http.apache.ApacheHttpClient$ApacheConnectionManagerFactory.create(ApacheHttpClient.java:637)

相关的gradle信息是。

android {
    compileSdk 30
    defaultConfig {
        applicationId "com.neurostim.zephyrapnea"
        minSdk 21
        targetSdk 30
dependencies {
    implementation platform('software.amazon.awssdk:bom:2.17.227')