Cannot find module with tag in import path (Android NDK)

MoMo picture MoMo · Oct 30, 2014 · Viewed 11.2k times · Source

I am getting so frustrated with this issue. I keep getting it and I cannot figure out why. Here is my Android.mk in src/jni

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)

and here is my Android.mk in my /jni/ffmpeg-2.4.2/android/armv7-a

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]

I keep getting this issue when building (ndk-build) or cleaning project by 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 ****

Please help :(

Answer

ashoke picture ashoke · Oct 30, 2014

To use import-module you will need to set/export environment variable NDK_MODULE_PATH pointing to the parent folder path of your import module.

    $(call import-module,ffmpeg-2.4.2/android/armv7-a)

So for <parent-path>/ffmpeg-2.4.2/android/armv7-a, set/export NDK_MODULE_PATH = parent-path

Another option is to explicitly add the path, add below line just before call import-module, for eg:

    $(call import-add-path, parent-path)
    $(call import-module,ffmpeg-2.4.2/android/armv7-a)

see this for other examples