Skip to content

Commit 0b09bea

Browse files
Fixed data tracks failing to load in apps minified with R8
The data track bindings call Rust through JNA. libjnidispatch resolves JNA's classes and fields by name, and JNA reads the bindings' Structure and Callback subclasses reflectively, but neither JNA nor livekit-uniffi-android ships keep rules, so R8 renamed or stripped them and the native library failed to load. Added the rules from JNA's FAQ to the consumer rules.
1 parent 12433f2 commit 0b09bea

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"client-sdk-android": patch
3+
---
4+
5+
Fixed data tracks failing to load in apps minified with R8.

livekit-android-sdk/consumer-rules.pro

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,13 @@
4848
-keepclassmembers class com.google.protobuf.** extends com.google.protobuf.GeneratedMessageLite {
4949
<fields>;
5050
}
51+
52+
# JNA (UniFFI data track bindings)
53+
#########################################
54+
# libjnidispatch looks up JNA's classes and fields by name, and JNA reads the bindings'
55+
# Structure and Callback subclasses reflectively. livekit-uniffi-android ships no rules for
56+
# either. These are the rules from JNA's FAQ.
57+
-dontwarn java.awt.*
58+
-keep class com.sun.jna.* { *; }
59+
-keep class * extends com.sun.jna.* { *; }
60+
-keepclassmembers class * extends com.sun.jna.* { public *; }

0 commit comments

Comments
 (0)