我试图在实验性插件中使用带有Android NDK的ffmpeg库。
我正在尝试编译此示例: https://github.com/roman10/android-ffmpeg-tutorial/blob/master/android-ffmpeg-tutorial01/jni/tutorial01.c
我的问题是编译器找不到头文件:
Error:(13, 32) libavcodec/avcodec.h: No such file or directory
我为build.grade添加了标志:
cppFlags += "-ilibavcodec -ilibavutil -ilibavformat -ilibswscale"
ldFlags += "-llibavcodec -llibavutil -llibavformat -llibswscale"
这似乎让lint高兴,但不是编译器。 (不确定我是否做得对吗?)
build.grade看起来像这样:
apply plugin: 'com.android.model.application'
model {
android {
compileSdkVersion = 23
buildToolsVersion = "23.0.1"
defaultConfig.with {
applicationId = "roman10.tutorial.android_ffmpeg_tutorial01"
minSdkVersion.apiLevel = 10
targetSdkVersion.apiLevel = 23
}
}
compileOptions.with {
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
}
android.buildTypes {
release {
minifyEnabled = false
proguardFiles += file('proguard-rules.pro')
}
}
android.ndk {
moduleName = "tutorial01"
ldLibs += ["android","log","jnigraphics","z"]
cppFlags += "-ilibavcodec -ilibavutil -ilibavformat -ilibswscale"
ldFlags += "-llibavcodec -llibavutil -llibavformat -llibswscale"
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-v4:23.0.1'
}
感谢。