Description
When initializing PeerConnectionFactory on Android, the app crashes because the native WebRTC library (libjingle_peerconnection_so.so) fails to find the Java class org.jni_zero.JniInit.
This happens on release builds with R8/ProGuard enabled. The crash is reproducible on AGP 8.x (Gradle 8.x) with WebRTC binaries.
Steps to reproduce
- Add WebRTC dependency with bundled
libjingle_peerconnection_so.so.
- Enable
minifyEnabled true with R8 (default in release).
- Build and run on a device.
- Call
PeerConnectionFactory.initialize(...).
Expected behavior
The library should load cleanly and initialize without requiring extra ProGuard rules.
Actual behavior
The app crashes during startup with ClassNotFoundException for org.jni_zero.JniInit.
Environment
- Android Gradle Plugin: 8.7.3
- Gradle: 8.x
- WebRTC library: 137.7151.04
- Device: [Pixel 6a, Android 16]
- Build:
release with R8
Description
When initializing
PeerConnectionFactoryon Android, the app crashes because the native WebRTC library (libjingle_peerconnection_so.so) fails to find the Java classorg.jni_zero.JniInit.This happens on release builds with R8/ProGuard enabled. The crash is reproducible on AGP 8.x (Gradle 8.x) with WebRTC binaries.
Steps to reproduce
libjingle_peerconnection_so.so.minifyEnabled truewith R8 (default in release).PeerConnectionFactory.initialize(...).Expected behavior
The library should load cleanly and initialize without requiring extra ProGuard rules.
Actual behavior
The app crashes during startup with
ClassNotFoundExceptionfororg.jni_zero.JniInit.Environment
releasewith R8