Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/silent-klaxon-proguard.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"client-sdk-android": patch
---

Fixed ProGuard/R8 minification crash in release builds when using AgentAttributes. Added @Keep annotations to Klaxon-based data classes and updated ProGuard rules to prevent obfuscation of reflection-based JSON parsing classes. #808
8 changes: 8 additions & 0 deletions livekit-android-sdk/consumer-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,11 @@
# Protobuf
#########################################
-keep class * extends com.google.protobuf.GeneratedMessageLite { *; }

# Klaxon JSON parsing
#########################################
# Klaxon uses reflection and doesn't ship ProGuard rules.
# Keep Klaxon library classes for reflection to work
-keep class com.beust.klaxon.** { *; }
-keep interface com.beust.klaxon.** { *; }
# Data classes using Klaxon should be annotated with @Keep at the source level
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package io.livekit.android.room.types

import android.annotation.SuppressLint
import androidx.annotation.Keep
import com.beust.klaxon.Converter
import com.beust.klaxon.Json
import com.beust.klaxon.JsonValue
Expand All @@ -38,6 +39,7 @@ internal val klaxon = Klaxon()
.convert(AgentOutput::class, { AgentOutput.fromValue(it.string!!) }, { "\"${it.value}\"" })
.convert(AgentSdkState::class, { AgentSdkState.fromValue(it.string!!) }, { "\"${it.value}\"" })

@Keep
data class AgentAttributes(
@Json(name = "lk.agent.inputs")
val lkAgentInputs: List<AgentInput>? = null,
Expand All @@ -58,6 +60,7 @@ data class AgentAttributes(
}
}

@Keep
enum class AgentInput(val value: String) {
Audio("audio"),
Text("text"),
Expand All @@ -73,6 +76,7 @@ enum class AgentInput(val value: String) {
}
}

@Keep
enum class AgentOutput(val value: String) {
Audio("audio"),
Transcription("transcription");
Expand All @@ -87,6 +91,7 @@ enum class AgentOutput(val value: String) {
}

// Renamed from AgentState to AgentSdkState to avoid naming conflicts elsewhere.
@Keep
enum class AgentSdkState(val value: String) {
Idle("idle"),
Initializing("initializing"),
Expand All @@ -109,6 +114,7 @@ enum class AgentSdkState(val value: String) {
/**
* Schema for transcription-related attributes
*/
@Keep
@SuppressLint("UnsafeOptInUsageError")
@Serializable
data class TranscriptionAttributes(
Expand Down