You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用FFmpegMediaPlayer后APK体积骤增35MB,寻求解决方案

解决FFmpegMediaPlayer导致APK体积暴涨的问题

Hey there, I totally get your frustration—adding a library that balloons your APK by 35MB out of nowhere is never fun, especially when you didn’t manually add any extra files! Let’s break down what’s going on, how to fix it, and confirm you’re definitely not alone in this.

为什么体积会暴涨?

The default com.github.wseemann:FFmpegMediaPlayer:1.0.4 dependency includes precompiled FFmpeg binaries for all major Android CPU architectures: armeabi-v7a, arm64-v8a, x86, and x86_64. Each of these binary files is several MB in size, and together they add up to that 35MB increase you’re seeing. Most apps don’t actually need to support all four architectures, so that’s a huge amount of unnecessary bloat.

可行的解决办法

Here are some practical steps to cut down that APK size significantly:

  • Only include CPU architectures your users actually need
    Most Android devices run on arm-based architectures (armeabi-v7a for older devices, arm64-v8a for modern ones). You can exclude x86/x86_64 (which are mainly for emulators and a small number of devices) by adding this to your app-level build.gradle file:

    android {
        defaultConfig {
            ndk {
                abiFilters 'armeabi-v7a', 'arm64-v8a'
            }
        }
    }
    

    This alone can shave off 10-15MB from your APK.

  • Use APK Splits to serve architecture-specific APKs
    Instead of building a single universal APK with all architectures, split it into separate APKs for each architecture. Users will only download the version that matches their device, drastically reducing the download size. Add this to your build.gradle:

    android {
        splits {
            abi {
                enable true
                reset()
                include 'armeabi-v7a', 'arm64-v8a'
                universalApk false // Disable the universal APK if you don't need it
            }
        }
    }
    

    When you build your app, you’ll get separate APKs for each architecture, each with a much smaller footprint.

  • Compile a trimmed-down FFmpeg build
    If you only need support for specific media formats (e.g., MP4/H.264 instead of all possible codecs), you can compile FFmpeg yourself with only the necessary features, then wrap it with the FFmpegMediaPlayer library. This takes more work, but can cut the FFmpeg binary size by half or more. The library’s repo has documentation on how to do this.

  • Check for duplicate dependencies
    Run the command ./gradlew app:dependencies in your project root to generate a dependency tree. Make sure no other libraries in your project are including FFmpeg binaries (this is rare, but worth checking to avoid redundant code).

其他开发者的情况

You’re definitely not alone! This is a common complaint with FFmpeg-based libraries on Android. There are dozens of threads and repo issues from developers dealing with the same volume bloat. Most of them resolve it by limiting supported architectures or using APK splits—those are the go-to solutions for this problem.

内容的提问来源于stack exchange,提问作者Arren

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.15 04:35:41