如何从Android apk中删除不必要的外部库文件?

huangapple go评论78阅读模式
英文:

How to remove unnecessary external library files from Android apk?

问题

我正在使用FFmpegKit对音频文件进行重新采样。

apk文件夹中包含许多位于lib文件夹中的SO文件。

我相信其中只有少数几个SO文件与我相关。因此,为了减小apk文件的大小,我想逐个删除这些SO文件并测试功能。

我应该如何操作?

英文:

I am using FFmpegKit to resample audio files.

The apk contains many SO files in the lib folder.

如何从Android apk中删除不必要的外部库文件?

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?

答案1

得分: 1

你可以将这些代码行放入Gradle文件的android块中,以排除不必要的.so文件,如下所示:

android {
    // ...

    packagingOptions {
        resources {
            excludes += "lib/*/libavformat.so"
            excludes += "lib/*/libavfilter.so"
        }
    }
}
英文:

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"
        }
    }
 }

huangapple
  • 本文由 发表于 2023年5月21日 01:44:27
  • 转载请务必保留本文链接:https://go.coder-hub.com/76296585.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定