Skip to content

Crash on Android: org.jni_zero.JniInit not found when loading libjingle_peerconnection_so (WebRTC + AGP 8.x / R8 shrinker) #39

@nightjar0

Description

@nightjar0

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

  1. Add WebRTC dependency with bundled libjingle_peerconnection_so.so.
  2. Enable minifyEnabled true with R8 (default in release).
  3. Build and run on a device.
  4. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions