google/ExoPlayer · error · VpxDecoderException

Failed to load decoder native libraries.

Error message

Failed to load decoder native libraries.

What it means

VpxDecoder's constructor checks VpxLibrary.isAvailable() and throws if the libvpx native libraries (libvpx + the JNI wrapper) could not be loaded. This is a deployment/packaging failure: the APK does not contain the expected .so files for the device ABI, so no VP9 software decoding is possible.

Source

Thrown at extensions/vp9/src/main/java/com/google/android/exoplayer2/ext/vp9/VpxDecoder.java:80

   *
   * @param numInputBuffers The number of input buffers.
   * @param numOutputBuffers The number of output buffers.
   * @param initialInputBufferSize The initial size of each input buffer.
   * @param cryptoConfig The {@link CryptoConfig} object required for decoding encrypted content.
   *     May be null and can be ignored if decoder does not handle encrypted content.
   * @param threads Number of threads libvpx will use to decode.
   * @throws VpxDecoderException Thrown if an exception occurs when initializing the decoder.
   */
  public VpxDecoder(
      int numInputBuffers,
      int numOutputBuffers,
      int initialInputBufferSize,
      @Nullable CryptoConfig cryptoConfig,
      int threads)
      throws VpxDecoderException {
    super(new DecoderInputBuffer[numInputBuffers], new VideoDecoderOutputBuffer[numOutputBuffers]);
    if (!VpxLibrary.isAvailable()) {
      throw new VpxDecoderException("Failed to load decoder native libraries.");
    }
    this.cryptoConfig = cryptoConfig;
    if (cryptoConfig != null && !VpxLibrary.vpxIsSecureDecodeSupported()) {
      throw new VpxDecoderException("Vpx decoder does not support secure decode.");
    }
    vpxDecContext =
        vpxInit(/* disableLoopFilter= */ false, /* enableRowMultiThreadMode= */ false, threads);
    if (vpxDecContext == 0) {
      throw new VpxDecoderException("Failed to initialize decoder");
    }
    setInitialInputBufferSize(initialInputBufferSize);
  }

  @Override
  public String getName() {
    return "libvpx" + VpxLibrary.getVersion();
  }

View on GitHub (pinned to dd430f7053)

Solutions

  1. Ensure the VP9 extension (and its native libs for all supported ABIs: armeabi-v7a, arm64-v8a, x86, x86_64) is packaged — check the APK's lib/ directories.
  2. Call VpxLibrary.isAvailable() before playback and, if false, fall back to MediaCodec VP9 decoding or exclude the extension renderer via DefaultRenderersFactory.
  3. If building the extension from source, verify the NDK build produced and loaded libvpx + JNI wrapper correctly.
  4. Keep the extension .so files out of ABI splits that omit them, or restrict abiFilters accordingly.

Example fix

// before
DefaultRenderersFactory factory = new DefaultRenderersFactory(context); // includes libvpx renderer

// after
DefaultRenderersFactory factory = new DefaultRenderersFactory(context);
if (!VpxLibrary.isAvailable()) {
  factory.setAllowedVideoDecoders(Arrays.asList("OMX.google.vp9.decoder"));
  // or build the factory with setEnableDecoderFallback(true) and let MediaCodec handle VP9
}
Defensive patterns

Strategy: fallback

Validate before calling

if (!VpxLibrary.isAvailable()) { /* build RenderersFactory without LibvpxVideoRenderer; rely on MediaCodec VP9 */ }

Try / catch

catch (VpxDecoderException e) during renderer selection -> skip the libvpx renderer and let MediaCodec try the track.

Prevention

When it happens

Trigger: Instantiating VpxDecoder (e.g. LibvpxVideoRenderer being used for a VP9 track) on a device whose ABI has no matching libvpx JNI library, or where System.loadLibrary failed earlier. VpxLibrary.isAvailable() returns false.

Common situations: Forgetting to add the extension's AAR/JNI dependency or only shipping armv7 libs to an arm64-only device; proguard/R8 stripping the JNI wrapper; using the renderer on emulators with uncommon ABIs; missing ReLinker flags in custom builds.

Related errors


AI-assisted analysis of google/ExoPlayer@dd430f7053 (2026-08-14). Data as JSON: /api/errors/85c4c41f5186fbca. Report an issue: GitHub.