通过以下步骤成功构建ffmpeg后
http://stackoverflow.com/questions/22471514/ffmpeg-build-output-is-not-showing
Now I have copy include and all .a file into my JNI folder. and my Android.mk
file is as:-
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := ffmpegutils
LOCAL_SRC_FILES := tutorial02.c
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
LOCAL_LDLIBS := -L$(NDK_PLATFORMS_ROOT)/$(TARGET_PLATFORM)/arch-arm/usr/lib -L$(LOCAL_PATH) -lavformat -lavcodec -lavfilter -lavutil -lswscale -llog -ljnigraphics -lz -ldl -lgcc
include $(BUILD_SHARED_LIBRARY)
但我的项目给出错误为:-
Description Resource Path Location Type
make: *** [obj/local/armeabi/libffmpegutils.so] Error 1 MainActivity C/C++ Problem
undefined reference to 'ANativeWindow_unlockAndPost' MainActivity line 231, external location: /home/kiwitech/Documents/development/tools/ndk/android-ndk-r9d/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/arm-linux-androideabi/bin/ld: ./obj/local/armeabi/objs/ffmpegutils/tutorial02.o: in function decodeAndRender:jni/tutorial02.c C/C++ Problem
undefined reference to 'ANativeWindow_lock' MainActivity line 222, external location: /home/kiwitech/Documents/development/tools/ndk/android-ndk-r9d/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/arm-linux-androideabi/bin/ld: ./obj/local/armeabi/objs/ffmpegutils/tutorial02.o: in function decodeAndRender:jni/tutorial02.c C/C++ Problem
undefined reference to 'ANativeWindow_release' MainActivity line 150, external location: /home/kiwitech/Documents/development/tools/ndk/android-ndk-r9d/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/arm-linux-androideabi/bin/ld: ./obj/local/armeabi/objs/ffmpegutils/tutorial02.o: in function naSetSurface:jni/tutorial02.c C/C++ Problem
undefined reference to 'ANativeWindow_setBuffersGeometry' MainActivity line 147, external location: /home/kiwitech/Documents/development/tools/ndk/android-ndk-r9d/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/arm-linux-androideabi/bin/ld: ./obj/local/armeabi/objs/ffmpegutils/tutorial02.o: in function naSetSurface:jni/tutorial02.c C/C++ Problem
undefined reference to 'ANativeWindow_fromSurface' MainActivity line 145, external location: /home/kiwitech/Documents/development/tools/ndk/android-ndk-r9d/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/arm-linux-androideabi/bin/ld: ./obj/local/armeabi/objs/ffmpegutils/tutorial02.o: in function naSetSurface:jni/tutorial02.c C/C++ Problem
请大家帮帮我。
你也必须链接android库,所以在你的LOCAL_LDLIBS中添加- landoid
$NDK/docs下的stable - api .html文件解释:
所有相应的函数都由"libandroid. exe"提供。带有API级别9的库版本。要使用它,请使用以下方法:LOCAL_LDLIBS += - landoid