From 9f321c4958a0b6d175b159f28984be9e1fce52ac Mon Sep 17 00:00:00 2001 From: Konstantin Date: Wed, 3 Jul 2024 14:15:35 +0200 Subject: [PATCH] fix: use OkHttp engine instead of CIO to ensure compatibility with Android 5 --- lib/build.gradle | 2 +- lib/src/main/java/com/telemetrydeck/sdk/TelemetryClient.kt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/build.gradle b/lib/build.gradle index 3e18f56..01805a1 100644 --- a/lib/build.gradle +++ b/lib/build.gradle @@ -47,7 +47,7 @@ dependencies { implementation 'com.google.android.material:material:1.4.0' // HTTP Client implementation "io.ktor:ktor-client-core:$ktor_version" - implementation "io.ktor:ktor-client-cio:$ktor_version" + implementation "io.ktor:ktor-client-okhttp:$ktor_version" // HTTP Serialization implementation "io.ktor:ktor-client-serialization:$ktor_version" implementation "io.ktor:ktor-client-content-negotiation:$ktor_version" diff --git a/lib/src/main/java/com/telemetrydeck/sdk/TelemetryClient.kt b/lib/src/main/java/com/telemetrydeck/sdk/TelemetryClient.kt index 04b1f2e..87d53c7 100644 --- a/lib/src/main/java/com/telemetrydeck/sdk/TelemetryClient.kt +++ b/lib/src/main/java/com/telemetrydeck/sdk/TelemetryClient.kt @@ -1,7 +1,7 @@ package com.telemetrydeck.sdk import io.ktor.client.* -import io.ktor.client.engine.cio.* +import io.ktor.client.engine.okhttp.* import io.ktor.client.plugins.DefaultRequest import io.ktor.client.plugins.contentnegotiation.ContentNegotiation import io.ktor.client.plugins.logging.DEFAULT @@ -18,7 +18,7 @@ import java.util.* * The HTTP client to communicate with TelemetryDeck's API */ internal class TelemetryClient(private val telemetryAppID: UUID, private val apiBaseURL: URL, private val showDebugLogs: Boolean, private val debugLogger: DebugLogger?) { - private val client: HttpClient = HttpClient(CIO) { + private val client: HttpClient = HttpClient(OkHttp) { install(ContentNegotiation) { json() }