Skip to content

[Feature Request] Android: build without audio compression and the TAndroidLame dependency #427

Open

Description

@chocky335

Current behavior

Every Android app that installs react-native-compressor ships libandroidlame.so, the LAME MP3 encoder. android/build.gradle adds it from com.github.kaushik-naik:TAndroidLame:277c2ab4b0, a fork in a personal GitHub account built by JitPack, and adds the JitPack repository for it. Only Audio.compress uses the encoder. Apps that call only Image.compress or Video.compress ship it anyway.

This has cost users work: the Play Console 16 KB warning (#366, #373, #379; #372 moved to the current fork in 1.14.0), hand-written patches that strip the audio module (comments on #355 and #379), packagingOptions excludes (#373), and a manifest merge failure from the fork's allowBackup="true" (#373). Our app uses image and video compression only and carries a patch-package patch for this.

Expected behavior

One Gradle property turns audio compression off:

# android/gradle.properties
Compressor_enableAudio=false

The default is true, so nothing changes for current users. The name follows the existing Compressor_* properties. When the flag is false, the build adds neither TAndroidLame nor jlayer nor the JitPack repository, the Kotlin file that imports LAME gives way to a stub, and Audio.compress on Android rejects with [E_AUDIO_DISABLED] Audio compression is disabled in this build. Image, video, thumbnail, upload and download do not change. iOS does not change.

Two questions:

  1. When the flag is off, reject (my suggestion, the developer sees it at once) or resolve with the input URL, like the current fallback when encoding fails?
  2. Main only (2.x), or also a backport to the 1.19.2 branch?

The PR would carry the flag in android/build.gradle, the LAME code moved unchanged into its own source set with a stub for the off case, a CI job that builds the example with the flag off and checks the APK for libandroidlame.so, a README section and a Jest test for the rejection. No JS or Nitro spec change. I can send it as soon as you agree with the approach.

Platform

  • Android
  • iOS

React Native Version

0.86.3 (the flag does not depend on it)

React Native Compressor Version

2.0.3 (main), 1.19.4 (1.19.2 branch)

Reproducible Steps And Demo

  1. curl -L -o lame.aar https://jitpack.io/com/github/kaushik-naik/TAndroidLame/277c2ab4b0/TAndroidLame-277c2ab4b0.aar
  2. unzip -l lame.aar | grep '\.so$' lists jni/arm64-v8a/libandroidlame.so, jni/armeabi-v7a/libandroidlame.so, jni/x86/libandroidlame.so and jni/x86_64/libandroidlame.so.
  3. Every app that depends on this library packages them, whether or not it calls Audio.compress.

Activity

  1. github-actions commented on Oct 20, 2026

    @github-actions

    👋 @chocky335
    Thanks for opening your issue here! If you find this package useful hit the star🌟!

  2. chocky335 commented on Nov 3, 2026

    @chocky335
    Author

    No reply in two weeks, so I went ahead with the defaults from the issue: reject with [E_AUDIO_DISABLED], main first. The PR is up at #433, and I can switch it to resolve-with-input or backport it to 1.19.2 if you prefer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions