【发布时间】:2018-02-23 10:31:18
【问题描述】:
我在我的应用程序中使用https://github.com/WritingMinds/ffmpeg-android 库。 我发现 Apk 大小约为 20mb,它包含 ABI(x86 和 armeabi-v7a)中的资产,使用 Android Studio 中的 apk 分析器。find screenshot here
所以为了修复它,我使用了developer.android.com中提到的拆分
android {...
splits
{
// Configures multiple APKs based on ABI.
abi {
// Enables building multiple APKs per ABI.
enable true
// By default all ABIs are included, so use reset() and include to specify that we only
// want APKs for x86, armeabi-v7a, and mips.
// Resets the list of ABIs that Gradle should create APKs for to none.
reset()
// Specifies a list of ABIs that Gradle should create APKs for.
include "x86", "armeabi-v7a", "mips"
// Specifies that we do not want to also generate a universal Apk that includes all ABIs.
universalApk false
}
}
}
它为每个 ABI 生成两个 Apk,但它并没有减少我使用 Apk 分析器检查的应用程序大小,并且它仍然拥有两个 ABI 的资产。
【问题讨论】:
-
更好的方法是使用静态ffmpeg库而不是共享,因为共享库放在apk中,如果你使用静态库,库的部分使用代码被编译成apk的.so跨度>
标签: android apk android-ffmpeg