gpt4 book ai didi

android - 验证者拒绝类 software.amazon.awssdk.http.apache.ApacheHttpClient

转载 作者:行者123 更新时间:2023-12-05 00:04:19 28 4
gpt4 key购买 nike

我正在尝试运行我从 here 复制粘贴的代码,特别是这一行

val region = Region.AP_SOUTHEAST_1
val s3 = S3Client.builder().region(region).build()

但是每次我运行它,它都会给我这个错误

java.lang.VerifyError: Verifier rejected classsoftware.amazon.awssdk.http.apache.ApacheHttpClient: voidsoftware.amazon.awssdk.http.apache.ApacheHttpClient.lambda$LRMaF_8eLuzzpRjS-Ew4gJswCBw(org.apache.http.client.methods.HttpRequestBase) failed to verify: voidsoftware.amazon.awssdk.http.apache.ApacheHttpClient.lambda$LRMaF_8eLuzzpRjS-Ew4gJswCBw(org.apache.http.client.methods.HttpRequestBase):[0x0] 'this' argument 'Reference:org.apache.http.client.methods.HttpRequestBase' not instance of'Reference:org.apache.http.client.methods.AbstractExecutionAwareRequest'(declaration of 'software.amazon.awssdk.http.apache.ApacheHttpClient'appears in/data/app/com.imincode.earthlings-Jxs426ZYpcjwZtg1zzKjkw==/base.apk!classes3.dex)at software.amazon.awssdk.http.apache.ApacheHttpClient.builder(ApacheHttpClient.java:133)at software.amazon.awssdk.http.apache.ApacheSdkHttpService.createHttpClientBuilder(ApacheSdkHttpService.java:29)at software.amazon.awssdk.core.internal.http.loader.-$$Lambda$-cEpDqlhpsSVBRGa6lPjzgTy1tM.apply(UnknownSource:2)at java.util.Optional.map(Optional.java:211)at software.amazon.awssdk.core.internal.http.loader.DefaultSdkHttpClientBuilder.buildWithDefaults(DefaultSdkHttpClientBuilder.java:41)at software.amazon.awssdk.core.client.builder.SdkDefaultClientBuilder.lambda$resolveSyncHttpClient$5$SdkDefaultClientBuilder(SdkDefaultClientBuilder.java:274)at software.amazon.awssdk.core.client.builder.-$$Lambda$SdkDefaultClientBuilder$mSpkyGAugx5W7tgD88eQuJnqvEs.get(UnknownSource:2)at java.util.Optional.orElseGet(Optional.java:263)at software.amazon.awssdk.core.client.builder.SdkDefaultClientBuilder.resolveSyncHttpClient(SdkDefaultClientBuilder.java:274)at software.amazon.awssdk.core.client.builder.SdkDefaultClientBuilder.finalizeSyncConfiguration(SdkDefaultClientBuilder.java:225)at software.amazon.awssdk.core.client.builder.SdkDefaultClientBuilder.syncClientConfiguration(SdkDefaultClientBuilder.java:158)at software.amazon.awssdk.services.s3.DefaultS3ClientBuilder.buildClient(DefaultS3ClientBuilder.java:27)at software.amazon.awssdk.services.s3.DefaultS3ClientBuilder.buildClient(DefaultS3ClientBuilder.java:22)at software.amazon.awssdk.core.client.builder.SdkDefaultClientBuilder.build(SdkDefaultClientBuilder.java:129)

最佳答案

我在使用时间流数据库时遇到了同样的错误。所以在我的例子中,timestreamWriteClient 接受 ApacheHttpClient.Builder:

ApacheHttpClient.Builder httpClientBuilder =
ApacheHttpClient.builder();

return TimestreamWriteClient.builder()
.httpClientBuilder(httpClientBuilder)
.overrideConfiguration(overrideConfig.build())
.region(Region.US_EAST_1)
.build();

并且在运行时,当应用程序尝试创建 apache 客户端时,我遇到了这个错误。因此,在一些调查中,我发现我可以使用另一个 HTTP 客户端 - UrlConnectionHttpClient 并将其传递给 TimestreamWriteClient.Builder。

httpClientBuilder: UrlConnectionHttpClient.Builder = UrlConnectionHttpClient.builder()

但是这个客户端应该单独包含:

implementation 'software.amazon.awssdk:url-connection-client'

可以加版本,在末尾加“:X.Y.Z”,但是我用的是BOM,所以对版本一无所知:

implementation platform('software.amazon.awssdk:bom:2.15.0')

因此,我认为您也可以将此 HTTP 客户端传递给您的 S3 服务构建器,就像我使用 timestreamWriteClient 构建器一样。

关于android - 验证者拒绝类 software.amazon.awssdk.http.apache.ApacheHttpClient,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64015553/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com