Garmaine Staff asked 1 year ago

I am very new to AWS and I am trying to use their Amazon Rekognition API. I am getting a java.lang.NoSuchFieldError on this line in DetectLabelsAWS.java: AmazonRekognition rekognitionClient = AmazonRekognitionClientBuilder.defaultClient();

Has anyone seen this error before? I'm not sure how to fix it. Here is the full error:

    Process: com.example.cycldapp, PID: 12320
    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!classes3.dex)
        at org.apache.http.conn.ssl.SSLConnectionSocketFactory.<clinit>(SSLConnectionSocketFactory.java:151)
        at com.amazonaws.http.apache.client.impl.ApacheConnectionManagerFactory.getPreferredSocketFactory(ApacheConnectionManagerFactory.java:89)
        at com.amazonaws.http.apache.client.impl.ApacheConnectionManagerFactory.create(ApacheConnectionManagerFactory.java:66)
        at com.amazonaws.http.apache.client.impl.ApacheConnectionManagerFactory.create(ApacheConnectionManagerFactory.java:59)
        at com.amazonaws.http.apache.client.impl.ApacheHttpClientFactory.create(ApacheHttpClientFactory.java:50)
        at com.amazonaws.http.apache.client.impl.ApacheHttpClientFactory.create(ApacheHttpClientFactory.java:38)
        at com.amazonaws.http.AmazonHttpClient.<init>(AmazonHttpClient.java:334)
        at com.amazonaws.http.AmazonHttpClient.<init>(AmazonHttpClient.java:318)
        at com.amazonaws.AmazonWebServiceClient.<init>(AmazonWebServiceClient.java:239)
        at com.amazonaws.AmazonWebServiceClient.<init>(AmazonWebServiceClient.java:225)
        at com.amazonaws.services.rekognition.AmazonRekognitionClient.<init>(AmazonRekognitionClient.java:318)
        at com.amazonaws.services.rekognition.AmazonRekognitionClient.<init>(AmazonRekognitionClient.java:304)
        at com.amazonaws.services.rekognition.AmazonRekognitionClientBuilder.build(AmazonRekognitionClientBuilder.java:61)
        at com.amazonaws.services.rekognition.AmazonRekognitionClientBuilder.build(AmazonRekognitionClientBuilder.java:27)
        at com.amazonaws.client.builder.AwsSyncClientBuilder.build(AwsSyncClientBuilder.java:46)
        at com.amazonaws.services.rekognition.AmazonRekognitionClientBuilder.defaultClient(AmazonRekognitionClientBuilder.java:45)
        at com.example.cycldapp.DetectLabelsAWS.detection(DetectLabelsAWS.java:28)
        at com.example.cycldapp.ReviewActivity.onCreate(ReviewActivity.java:68)
        at android.app.Activity.performCreate(Activity.java:7990)
        at android.app.Activity.performCreate(Activity.java:7979)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1309)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3308)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3477)
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2043)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:216)
        at android.app.ActivityThread.main(ActivityThread.java:7464)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:549)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:955)