标签:android studio;ffmpeg;ndk;jni
修改步骤:
首先通过NDK14编译出libffmpeg.so ,将include目录取出
通过AS建立基于jni的工程项目,将include目录放到cpp下;创建jniLibs/armeabi目录,将libffmpeg.so放到里边
3.配置CMakeLists.txt
添加如下:
#add the ffmpeg lib
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/main/cpp/include)
add_library(ffmpeg-lib SHARED IMPORTED )
set_target_properties(ffmpeg-lib PROPERTIES IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/src/main/jniLibs/armeabi/libffmpeg.so)
target_link_libraries( native-lib
ffmpeg-lib #ffmpeg lib
android #use the android log lib
${log-lib} )
4.配置build.gradle
主要添加arguments 和 ndk的配置
externalNativeBuild { cmake { cppFlags " " arguments ‘-DANDROID_TOOLCHAIN=clang‘,‘-DANDROID_STL=gnustl_static‘ } ndk { abiFilters ‘armeabi‘ } }
5.native_lib.cpp
#include <jni.h>That‘s all.
本文出自 “专注嵌入式多媒体技术” 博客,请务必保留此出处http://zyg0227.blog.51cto.com/1043164/1947097
Android Studio2.2.3 通过JNI引用ffmpeg库小结
标签:android studio;ffmpeg;ndk;jni
原文地址:http://zyg0227.blog.51cto.com/1043164/1947097