I'm busy adding FFmpegMediaMetadataRetriever
pre-build .aar
files to my project to reduce the Apk file size for each architecture.
This post added the following to his Gradle
:
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.
reset()
// Specifies a list of ABIs that Gradle should create APKs for.
include "x86", "x86_64", "armeabi-v7a", "arm64-v8a"
// Specifies that we want to also generate a universal APK that includes all ABIs.
universalApk false
}
}
//...
}
The FFmpegMediaMetadataRetriever
library provide the following .aar
files:
My questions:
- Should I place the
.aar
files in my libs
folder as it is (without creating folders for each architecture), or should I add it in a folder?
- Which of the above
.aar
files should I use to support all architectures?
- In the post he also talks about versioning, is this necessary (my application is live and I don't want to mess up the versioning - my current version is 21)?
He implemented versioning like this:
// Map for the version code that gives each ABI a value.
def abiCodes = ['x86':1, 'x86_64':2, 'armeabi-v7a':3, 'arm64-v8a':4]
// APKs for the same app that all have the same version information.
android.applicationVariants.all { variant ->
// Assigns a different version code for each output APK.
variant.outputs.each {
output ->
def abiName = output.getFilter(OutputFile.ABI)
output.versionCodeOverride = abiCodes.get(abiName, 0) * 100000 + variant.versionCode
}
}
I'm looking for someone that has perhaps used the .aar
files of FFmpegMediaMetadataRetriever
that can give me guidance on how to correctly implement it.
Edit 1
After learning more about different architectures/ABI's, I think it is safe to say that if I only include armeabi-v7a
then most devices would be "covered"? (My minimum sdk is 16).
Does that then mean that I don't have to split the APK and I don't have to worry about versioning?
I can then just import the .aar
- armv7-fmmr.aar
as normal?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…