我对这个问题感到非常沮丧。我一直得到它,我无法弄清楚为什么。这是我在src / jni中的Android.mk
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := tutorial01
LOCAL_SRC_FILES := tutorial01.c
LOCAL_LDLIBS := -llog -lz
LOCAL_SHARED_LIBRARIES := libavformat_static libavcodec_static libavutil_static
include $(BUILD_SHARED_LIBRARY)
$(call import-module,ffmpeg-2.4.2/android/armv7-a)
这是我的/jni/ffmpeg-2.4.2/android/armv7-a中的Android.mk
LOCAL_PATH:= $(call my-dir)
#static version of libavcodec
include $(CLEAR_VARS)
LOCAL_MODULE:= libavcodec
LOCAL_SRC_FILES:= lib/libavcodec.a
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
include $(PREBUILT_STATIC_LIBRARY)
#static version of libavformat
include $(CLEAR_VARS)
LOCAL_MODULE:= libavformat
LOCAL_SRC_FILES:= lib/libavformat.a
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
include $(PREBUILT_STATIC_LIBRARY)
#static version of libswscale
include $(CLEAR_VARS)
LOCAL_MODULE:= libswscale
LOCAL_SRC_FILES:= lib/libswscale.a
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
include $(PREBUILT_STATIC_LIBRARY)
#static version of libavutil
include $(CLEAR_VARS)
LOCAL_MODULE:= libavutil
LOCAL_SRC_FILES:= lib/libavutil.a
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
include $(PREBUILT_STATIC_LIBRARY)
![enter image description here][1]
在构建(ndk-build)或通过eclipse清理项目时,我一直遇到这个问题
**** Clean-only build of configuration Default for project android-ffmpeg-tutorial01 ****
/Applications/adt-bundle-mac-x86_64-20130514/android-ndk-r10c/ndk-build clean
Android NDK: jni/Android.mk: Cannot find module with tag 'ffmpeg-2.4.2/android/armv7-a' in import path
Android NDK: Are you sure your NDK_MODULE_PATH variable is properly defined ?
jni/Android.mk:11: *** Android NDK: Aborting. . Stop.
Android NDK: The following directories were searched:
Android NDK:
**** Build Finished ****
请帮助:(
答案 0 :(得分:9)
要使用import-module
,您需要设置/导出环境变量NDK_MODULE_PATH
,指向导入模块的父文件夹路径。
$(call import-module,ffmpeg-2.4.2/android/armv7-a)
因此,对于<parent-path>/ffmpeg-2.4.2/android/armv7-a
,请设置/导出NDK_MODULE_PATH = parent-path
另一种选择是明确添加路径,在call import-module
之前添加以下行,例如:
$(call import-add-path, parent-path)
$(call import-module,ffmpeg-2.4.2/android/armv7-a)
答案 1 :(得分:0)
我解决了!!我的问题是我的ffmpeg文件夹不在我的NDK / sources文件夹中。我不得不在NDK / sources中移动ffmpeg文件夹,我能够毫无问题地构建它。