Amazonsqsclientbuilder.defaultclient() Java.lang.nosuchfielderror: No Static Field Instance Of Type Lorg/apache/http/conn/ssl/allowallhostnameverifier
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.msgqueue3/com.example.msgqueue3.MainActivity}: java.lang.NullPointerException: Attempt to invoke inte
Solution 1:
I suggest to use the AWS Java SDK V2. It will allow you to use an alternate HTTP runtime, and avoid some of the mess with the Apache client, when working on Android.
GitHub Issue #1180 in the AWS Java SDK V2 repo addresses this topic.
Specifically, in your module-level build.gradle
, add dependencies:
dependencies {
implementation 'software.amazon.awssdk:sqs:2.13.49'
implementation 'software.amazon.awssdk:url-connection-client:2.13.49'
}
Now, initialize the SQS client:
val sqs = SqsClient.builder()
.httpClient(UrlConnectionHttpClient.create())
.region(Region.US_EAST_1)
.credentialsProvider(yourCredentialsHere())
.build()
Solution 2:
its working.
ProfileCredentialsProvidercredentialsProvider=newProfileCredentialsProvider();
try {
credentialsProvider.getCredentials();
} catch (Exception e) {
thrownewAmazonClientException(
"Cannot load the credentials from the credential profiles file. " +
"Please make sure that your credentials file is at the correct " +
"location (~/.aws/credentials), and is in valid format.",
e);
}
AmazonSQSsqs= AmazonSQSClientBuilder.standard()
.withCredentials(credentialsProvider)
.withRegion(Regions.US_WEST_2)
.build();
Post a Comment for "Amazonsqsclientbuilder.defaultclient() Java.lang.nosuchfielderror: No Static Field Instance Of Type Lorg/apache/http/conn/ssl/allowallhostnameverifier"