Skip to content

Commit 23f1bbe

Browse files
authored
Optimizations for proguard (#803)
* Optimizations for proguard * changeset * fix proguard to include jnizero which uses their own annotation * Enable minifying and use debug signing for sample release variant
1 parent 1c734e8 commit 23f1bbe

File tree

3 files changed

+19
-13
lines changed

3 files changed

+19
-13
lines changed

.changeset/two-sloths-tan.md

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+
Proguard rule optimizations

livekit-android-sdk/consumer-rules.pro

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,28 +13,27 @@
1313
}
1414

1515
-keep,includedescriptorclasses class io.livekit.android.**$$serializer { *; }
16-
-keepclassmembers class io.livekit.android.** {
17-
*** Companion;
18-
}
16+
1917
-keepclasseswithmembers class io.livekit.android.** {
2018
kotlinx.serialization.KSerializer serializer(...);
2119
}
2220

2321
# WebRTC
2422
#########################################
25-
-keep class livekit.org.webrtc.** { *; }
26-
27-
# JNI Zero initialization (required for WebRTC native method registration)
28-
-keep class livekit.org.jni_zero.JniInit {
29-
# Keep the init method un-obfuscated for native code callback
30-
private static java.lang.Object[] init();
23+
# Ensure java methods called from Native are preserved.
24+
-keepclasseswithmembers,includedescriptorclasses class * {
25+
@livekit.**.CalledByNative <methods>;
26+
}
27+
-keepclasseswithmembers,includedescriptorclasses class * {
28+
@livekit.**.CalledByNativeUnchecked <methods>;
3129
}
3230

3331
# NIST sdp parser
3432
#########################################
35-
-keep class android.gov.nist.** { *; }
36-
-dontwarn com.sun.nio.sctp.**
37-
-dontwarn org.apache.log4j.**
33+
# Preserve reflection used for Parser registrations
34+
-keep class android.gov.nist.javax.sdp.parser.*Parser { *; }
35+
-keep class android.gov.nist.javax.sdp.parser.ParserFactory { *; }
36+
-keep class android.gov.nist.javax.sdp.parser.SDPParser { *; }
3837

3938
# Protobuf
4039
#########################################

sample-app-compose/build.gradle

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@ android {
2323

2424
buildTypes {
2525
release {
26-
minifyEnabled false
26+
minifyEnabled true
2727
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
28+
// For testing purposes only. Use your own signing keys when making a production app.
29+
signingConfig signingConfigs.debug
2830
}
2931
}
3032
compileOptions {

0 commit comments

Comments
 (0)