androidffmpegapkandroid-ffmpeg

How to remove unnecessary external library files from Android apk?


I am using FFmpegKit to resample audio files.

The apk contains many SO files in the lib folder.

enter image description here

I believe that only a few of these SO files are relevant to me. So, in order to reduce the apk size, I would like to remove these SO files one by one and test the functionality.

How should I go about doing this?


Solution

  • You can put these lines of code in the android block of your Gradle file to exclude unnecessary .so files like this:

     android {
        // ...
    
        packagingOptions {
            resources {
                excludes += "lib/*/libavformat.so"
                excludes += "lib/*/libavfilter.so"
            }
        }
     }