请看编辑1
我正在忙于将FFmpegMediaMetadataRetriever预构建.aar文件添加到我的项目中以减少每个体系结构的Apk文件大小.
这篇帖子为他增加了以下内容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
}
}
//...
}
Run Code Online (Sandbox Code Playgroud)
该FFmpegMediaMetadataRetriever库提供以下.aar文件:
我的问题:
.aar文件放在我的libs文件夹中(不为每个架构创建文件夹),还是应该将其添加到文件夹中?.aar我应该使用上述哪些文件来支持所有体系结构?他实现了这样的版本控制:
// 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
}
}
Run Code Online (Sandbox Code Playgroud)
我正在寻找可能使用过这些.aar文件的人FFmpegMediaMetadataRetriever可以给我指导如何正确实现它.
经过学习更多有关不同的架构/ ABI的,我想一想它是保存地说,如果我只包括armeabi-v7a当时最设备将被"覆盖"?(我的最小sdk是16).
这是否意味着我不必拆分APK而我不必担心版本控制?
我可以直接导入.aar- armv7-fmmr.aar正常吗?
您可以使用指定所需目标 ABI 的产品风格生成不同的 APK。然后,您可以根据每个产品风格指定要使用的 FMMR gradle 依赖项或独立 AAR 文件。请参阅此 build.gradle 文件以供参考:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.wseemann.example"
minSdkVersion 15
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
flavorDimensions "version"
productFlavors {
fat {
ndk {
abiFilters "armeabi", "armeabi-v7a", "x86", "mips", "x86_64", "arm64-v8a"
}
}
armeabi {
ndk {
abiFilter "armeabi"
}
}
armeabi_v7a {
ndk {
abiFilter "armeabi-v7a"
}
}
x86 {
ndk {
abiFilter "x86"
}
}
mips {
ndk {
abiFilter "mips"
}
}
x86_64 {
ndk {
abiFilter "x86_64"
}
}
arm64_v8a {
ndk {
abiFilter "arm64-v8a"
}
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:28.0.0-rc01'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
// Product flavor, ABI specific dependencies
fatImplementation 'com.github.wseemann:FFmpegMediaMetadataRetriever:1.0.14'
armeabiImplementation 'com.github.wseemann:FFmpegMediaMetadataRetriever-armeabi:1.0.14'
armeabi_v7aImplementation'com.github.wseemann:FFmpegMediaMetadataRetriever-armeabi-v7a:1.0.14'
x86Implementation 'com.github.wseemann:FFmpegMediaMetadataRetriever-x86:1.0.14'
mipsImplementation 'com.github.wseemann:FFmpegMediaMetadataRetriever-mips:1.0.14'
x86_64Implementation 'com.github.wseemann:FFmpegMediaMetadataRetriever-x86_64:1.0.14'
arm64_v8aImplementation 'com.github.wseemann:FFmpegMediaMetadataRetriever-arm64-v8a:1.0.14'
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1163 次 |
| 最近记录: |