java – 为不同的架构生成APK – FFmpegMediaMetadataRetriever
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了java – 为不同的架构生成APK – FFmpegMediaMetadataRetriever,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含3789字,纯文字阅读大概需要6分钟。
内容图文
请看编辑1
我正忙着将FFmpegMediaMetadataRetriever pre-build .aar文件添加到我的项目中,以减少每个架构的Apk文件大小.
This帖子在他的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
}
}
//...
}
FFmpegMediaMetadataRetriever库提供以下.aar文件:
我的问题:
>我应该将.aar文件原样放在我的libs文件夹中(不为每个架构创建文件夹),还是应该将它添加到文件夹中?
>我应该使用上述.aar文件中的哪一个来支持所有体系结构?
>在帖子中他还谈到版本控制,这是必要的(我的应用程序是实时的,我不想搞砸版本控制 – 我目前的版本是21)?
他实现了这样的版本控制:
// 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
}
}
我正在寻找可能使用FFmpegMediaMetadataRetriever的.aar文件的人,它可以为我提供如何正确实现它的指导.
编辑1:
在学习了有关不同架构/ ABI的more后,我认为如果我只包含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'
}
内容总结
以上是互联网集市为您收集整理的java – 为不同的架构生成APK – FFmpegMediaMetadataRetriever全部内容,希望文章能够帮你解决java – 为不同的架构生成APK – FFmpegMediaMetadataRetriever所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。