Skip to content

Build Issue with Latest httpclient SDK #196

Description

@sakibanda

I am using Kotlin and using latest version 6.2.0

When trying to upload file from the app, i am getting following error:

FATAL EXCEPTION: DefaultDispatcher-worker-6
Process: app.amazeai.android, PID: 28754
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!classes5.dex)
at org.apache.http.conn.ssl.SSLConnectionSocketFactory.<clinit>(SSLConnectionSocketFactory.java:151)
at com.backblaze.b2.client.webApiHttpClient.HttpClientFactoryImpl$Builder.createConnectionManager(HttpClientFactoryImpl.java:196)
at com.backblaze.b2.client.webApiHttpClient.HttpClientFactoryImpl$Builder.build(HttpClientFactoryImpl.java:160)
at com.backblaze.b2.client.webApiHttpClient.HttpClientFactoryImpl.build(HttpClientFactoryImpl.java:66)
at com.backblaze.b2.client.webApiHttpClient.B2WebApiHttpClientImpl.<init>(B2WebApiHttpClientImpl.java:59)
at com.backblaze.b2.client.webApiHttpClient.B2WebApiHttpClientImpl.<init>(B2WebApiHttpClientImpl.java:49)
at com.backblaze.b2.client.webApiHttpClient.B2WebApiHttpClientImpl$Builder.build(B2WebApiHttpClientImpl.java:380)
at com.backblaze.b2.client.webApiHttpClient.B2StorageHttpClientBuilder.build(B2StorageHttpClientBuilder.java:68)
at com.backblaze.b2.client.webApiHttpClient.B2StorageHttpClientFactory.create(B2StorageHttpClientFactory.java:21)
at com.backblaze.b2.client.B2StorageClientFactoryPathBasedImpl.create(B2StorageClientFactoryPathBasedImpl.java:69)
at com.backblaze.b2.client.B2StorageClientFactory.create(B2StorageClientFactory.java:44)
at app.amazeai.android.data.repository.ImageRepositoryImpl.uploadFileToBackblaze(ImageRepository.kt:64)
at app.amazeai.android.ui.chats.ChatBoardViewModel$runImageGenerateApi$1$1$1.invokeSuspend(ChatBoardViewModel.kt:885)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:115)
at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:103)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)
Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@fcebd38, Dispatchers.IO]

I read (AllowAllHostnameVerifier) is gone for a very good reason: it is a security flaw. If you add it, your app is likely to be rejected for distribution on the Play Store
Reference: https://stackoverflow.com/questions/76276666/how-to-fix-no-static-field-instance-of-type-lorg-apache-http-conn-ssl-allowallh

How to fix this?

When i use version 3.1.0 with okhttp its working fine except mime type is not updated.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions