gpt4 book ai didi

android - FFMPEG Android 库增加大小

转载 作者:行者123 更新时间:2023-12-04 22:59:33 26 4
gpt4 key购买 nike

我在我的项目中使用 ffmpeg 库。问题是 App apk 大小太大。有谁知道如何减少apk大小?
任何帮助、建议或链接将不胜感激。谢谢你。

最佳答案

你好@tech_android 和@gulab 帕特尔。我已经找到了解决方案。
Android Gradle 允许您根据处理器(“armeabi-v7a”、“arm64-v8a”、“x86”和“x86_64”)拆分您的 apk。这样你最终会得到 4 个 apk 而不是一个,每个的大小将是第四部分,在 Google Play 中你上传所有四个 apk,当用户尝试下载你的应用时,Google Play 会选择正确的 apk取决于用户的设备处理器。
您必须以这种方式在 gradle 中设置应用拆分:
在 compilerOptions 节点下方(在 android json 节点内):

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 and x86_64.
// 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 "armeabi-v7a"
include "arm64-v8a"
include "x86"
include "x86_64"
// Specifies that we do not want to also generate a universal APK that includes all ABIs.
universalApk false
}
}
就在依赖节点之前:
// This next piece of code is used by apk Split
// map for the version code that gives each ABI a value. make sure to list all ABIs mentioned in splits block, an keep the order.
ext.versionCodes = ['armeabi-v7a': 1, 'arm64-v8a': 2, 'x86': 3, 'x86_64': 4]

关于android - FFMPEG Android 库增加大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50443539/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com