Android emulator getting TLS error when tried to communicate with server

0

I have an Android application which communicates with my .Net backend.

I use Android 9 in emulator, and the error doesn't show up when I use a phisycal device.

When I monitor the network via Chrome, I see this error, but not only 1 request, and truly, not only on the same request, I think it is random. The types of requests are only GET.

It is typically client or server error?

Error msg:

(failed)
    javax.net.ssl.SSLProtocolException: Read error: ssl=0xde690e80: Failure in SSL library, usually a protocol error error:1e000065:Cipher functions:OPENSSL_internal:BAD_DECRYPT (external/boringssl/src/crypto/fipsmodule/cipher/e_aes.c:1314 0xdc236dc3:0x00000000) error:1000008b:SSL routines:OPENSSL_internal:DECRYPTION_FAILED_OR_BAD_RECORD_MAC (external/boringssl/src/ssl/tls_record.cc:281 0xdc236dc3:0x00000000)
    

Kotlin code:

var builder: OkHttpClient.Builder = OkHttpClient.Builder()
            .addInterceptor(CustomResponseInterceptor(authApi, application, prefManager))
            .readTimeout(0, TimeUnit.DAYS)
            .writeTimeout(0, TimeUnit.DAYS)
            .connectTimeout(0, TimeUnit.DAYS)
            .retryOnConnectionFailure(true)

        builder = StethoUtil.initInterceptor(builder)
        val clientWithAuth = builder.build()

        val objectMapper = ObjectMapper().registerModule(KotlinModule())
        objectMapper.configure(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES, true)
        val factory = JacksonConverterFactory.create(objectMapper)

        return Retrofit.Builder()
            .baseUrl(url)
            .addConverterFactory(factory)
            .client(clientWithAuth)
            .build()
            .create(SalesApi::class.java)
android
android-studio
kotlin
okhttp
asked on Stack Overflow Sep 10, 2020 by Andreas1234 • edited Sep 10, 2020 by null_override

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0