我正在尝试使用Android Studio中的gradle将FFMPEG
构建到我的JNI
代码中。我已经将FFMPEG构建为.so
文件,为了适应不同的平台,我为不同的ABI(arm64-v8a, armeabi-v7a, mip, etc)
构建它。然后我需要确定build.gradle文件中当前构建的ABI。 / p>
参考Experimental Plugin User Guide,我的build.gradle看起来像这样:
apply plugin: 'com.android.model.native'
model{
repositories {
prebuilt(PrebuiltLibraries){
ffmpeg{
headers.srcDir "src/main/jni/build/${targetPlatform.getName()}/include"
binaries.withType(SharedLibraryBinary) {
sharedLibraryFile = file("src/main/jni/build/${targetPlatform.getName()}/libvflibrary.so")
}
}
}
}
android {
compileSdkVersion = 24
buildToolsVersion = "23.0.3"
defaultConfig {
minSdkVersion.apiLevel = 15
targetSdkVersion.apiLevel = 24
versionCode = 1
versionName = "1.0"
}
ndk{
//platformVersion = 21
moduleName = "library-jni"
stl = 'gnustl_static'
toolchain = "clang"
abiFilters.addAll(['armeabi', 'armeabi-v7a', 'arm64-v8a', 'mips'])
cppFlags.addAll(['-std=c++11', '-D__STDC_CONSTANT_MACROS'])
ldLibs.addAll(['log', 'android', 'z', 'EGL', 'GLESv2'])
}
sources {
main {
jni {
source{
srcDirs 'src/main/jni'
}
dependencies {
library 'ffmpeg' linkage 'shared'
}
}
}
}
}
}
我收到错误:
错误:没有这样的属性:类的targetPlatform: com.android.build.gradle.managed.NdkConfig。
有人对我如何解决这个问题有所了解吗?