-
Notifications
You must be signed in to change notification settings - Fork 29
Bugfix/minification proguard missing symbols #734
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Updates the example Android app and Millicast documentation to address a crash seen when enabling minification (missing Kotlin classes at runtime).
Changes:
- Add a ProGuard/R8 keep rule for
kotlin.*to the example app. - Enable minification for example Android release builds by default.
- Document the required keep rule in
doc/millicast.md.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| example/android/app/proguard-rules.pro | Adds a keep rule intended to prevent Kotlin classes from being stripped during minification. |
| example/android/app/build.gradle | Enables ProGuard/R8 minification for release builds in the example app. |
| doc/millicast.md | Documents the Android minification note and keep rule for Millicast integration. |
|
|
||
| # Add any project specific keep options here: | ||
|
|
||
| -keep class kotlin.** { *; } |
Copilot
AI
Jan 28, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-keep class kotlin.** { *; } disables shrinking/obfuscation for the entire Kotlin stdlib, which can significantly reduce the benefit of enabling minification (larger APK/AAB). Consider narrowing this rule to only the specific Kotlin classes that are reflectively/JNI-referenced (e.g., the unsigned types involved in the crash) so release builds still get meaningful shrinking.
| -keep class kotlin.** { *; } | |
| # Keep only specific Kotlin stdlib classes that are reflectively/JNI-referenced | |
| -keep class kotlin.UInt { *; } | |
| -keep class kotlin.ULong { *; } | |
| -keep class kotlin.UByte { *; } | |
| -keep class kotlin.UShort { *; } |
| When adding the Millicast integration into your android project, make sure to add the following keep rule in your `proguard-rules.pro` file: | ||
| ``` | ||
| -keep class kotlin.** { *; } | ||
| ``` | ||
|
|
||
| Otherwise, you will encounter a `ClassNotFoundException` when attempting to run the application. | ||
|
|
Copilot
AI
Jan 28, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This documentation asks integrators to manually add a ProGuard/R8 keep rule, but the library already publishes consumer rules via consumerProguardFiles (see android/build.gradle). To prevent production crashes when minification is enabled, consider shipping the necessary keep rule(s) in the library’s consumer ProGuard file instead of relying on every app to add a manual rule.
| When adding the Millicast integration into your android project, make sure to add the following keep rule in your `proguard-rules.pro` file: | |
| ``` | |
| -keep class kotlin.** { *; } | |
| ``` | |
| Otherwise, you will encounter a `ClassNotFoundException` when attempting to run the application. | |
| The Millicast integration ships its required ProGuard/R8 keep rules via the library's `consumerProguardFiles` configuration. | |
| In a typical setup, no additional ProGuard/R8 rules are needed to use Millicast with minification enabled. | |
| If you use a heavily customized ProGuard/R8 configuration, ensure that the consumer rules from the library are not being overridden or removed, otherwise you may encounter `ClassNotFoundException` errors at runtime. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Yousif-CS wouldn't it make more sense to add the R8 rules to the Millicast's consumer rules as is suggested here? Otherwise all Millicast SDK customers will have to include these rules I guess?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can, though from what I've seen in the docs it needs to be added at the app level? Let me try that.
|
|
||
| ## Note on minification on Android | ||
|
|
||
| When adding the Millicast integration into your android project, make sure to add the following keep rule in your `proguard-rules.pro` file: |
Copilot
AI
Jan 28, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Capitalize “Android” for consistency with the rest of the docs ("your Android project").
| When adding the Millicast integration into your android project, make sure to add the following keep rule in your `proguard-rules.pro` file: | |
| When adding the Millicast integration into your Android project, make sure to add the following keep rule in your `proguard-rules.pro` file: |
A customer ran into an issue when enabling minification and encountered the following crash:
This requires integrating applications to add a keep rule for
kotlin.*classes in their proguard file. This PR introduces it for the example application, enables minification for release builds by default and also adds a note in the documentation.