Skip to content

fix: R8 keep rules for JNA and AVS/WebRTC to prevent login crash #4604

Merged
MohamadJaara merged 1 commit intodevelopfrom
fix/r8-jna-avs-login-crash
Feb 19, 2026
Merged

fix: R8 keep rules for JNA and AVS/WebRTC to prevent login crash #4604
MohamadJaara merged 1 commit intodevelopfrom
fix/r8-jna-avs-login-crash

Conversation

@Garzas
Copy link
Contributor

@Garzas Garzas commented Feb 19, 2026


PR Submission Checklist for internal contributors

  • The PR Title

    • conforms to the style of semantic commits messages¹ supported in Wire's Github Workflow²
    • contains a reference JIRA issue number like SQPIT-764
    • answers the question: If merged, this PR will: ... ³
  • The PR Description

    • is free of optional paragraphs and you have filled the relevant parts to the best of your ability

What's new in this PR?

This PR fixes a release-only login crash caused by R8 shrinking/obfuscating classes used from native AVS/JNA code.

What was happening:

  • During login/call initialization, native FlowManager_attach tried to access Java classes/methods by name.
  • R8 removed/renamed required symbols, which led to NoSuchMethodError / ClassNotFoundException in com.waz.media.manager.*, then a native crash in libavs.so.
  • Previously seen JNA init issues were also covered by explicit JNA keep rules.

What was changed:

  • Added explicit ProGuard/R8 keep rules in proguard-rules.pro for:
    • com.sun.jna.** (+ Pointer.peer)
    • AVS/WebRTC classes used from native (com.waz.*, org.webrtc.*)
  • Added required WebRTC -dontwarn entries to let R8 complete.

Result:

  • internalCompatrelease builds and installs successfully.
  • Login no longer crashes on device.

Comment on lines +49 to +64
-keep class com.sun.jna.** { *; }
-keep class * extends com.sun.jna.** { *; }
-keepclassmembers class com.sun.jna.Pointer { long peer; }

# AVS/WebRTC classes are accessed from native code (FlowManager_attach).
# Keep concrete names and members to avoid NoSuchMethodError/ClassNotFoundException at runtime.
-keep class org.webrtc.** { *; }
-keep class com.waz.call.FlowManager { *; }
-keep class com.waz.avs.VideoRenderer { *; }
-keep class com.waz.call.CaptureDevice { *; }
-keep class com.waz.media.manager.** { *; }
-keep class com.waz.service.call.** { *; }
-keep class com.waz.soundlink.SoundLinkAPI { *; }
-dontwarn org.webrtc.CalledByNative
-dontwarn org.webrtc.JniCommon
-dontwarn org.webrtc.audio.AudioDeviceModule
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we have them in calling module

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They already there

@Garzas Garzas force-pushed the fix/r8-jna-avs-login-crash branch from 4c3953c to d04c55f Compare February 19, 2026 08:51
@sonarqubecloud
Copy link

@MohamadJaara MohamadJaara merged commit c9f3dac into develop Feb 19, 2026
25 of 29 checks passed
@MohamadJaara MohamadJaara deleted the fix/r8-jna-avs-login-crash branch February 19, 2026 08:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Comments