Repository navigation
Description
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=falseThe 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:
- 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?
- Main only (2.x), or also a backport to the
1.19.2branch?
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
curl -L -o lame.aar https://jitpack.io/com/github/kaushik-naik/TAndroidLame/277c2ab4b0/TAndroidLame-277c2ab4b0.aarunzip -l lame.aar | grep '\.so$'listsjni/arm64-v8a/libandroidlame.so,jni/armeabi-v7a/libandroidlame.so,jni/x86/libandroidlame.soandjni/x86_64/libandroidlame.so.- Every app that depends on this library packages them, whether or not it calls
Audio.compress.
Activity
github-actions commentedon Oct 20, 2026
👋 @chocky335
Thanks for opening your issue here! If you find this package useful hit the star🌟!
chocky335 commentedon Nov 3, 2026
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 to1.19.2if you prefer.