0

I want to import one ndroid.mk file into another android.mk file I have android.mk file in which i have

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := importfile
LOCAL_SRC_FILES := libEDSDK.a
/*LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/EDSDK $(LOCAL_PATH)/EDSDKErrors $(LOCAL_PATH)/EDSDKTypes*/
LOCAL_ARM_MODE := arm
TARGET_PLATFORM:=android-8
TARGET_ARCH_ABI:=armeabi
TARGET_ABI:=$(TARGET_PLATFORM)-$(TARGET_ARCH_ABI)
include $(PREBUILT_STATIC_LIBRARY)

I want to import this android.mk file into another android.mk file

$NDK_MODULE_PATHjni/module1/Android.mk:
 LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE    := EDSK
LOCAL_SRC_FILES := sample.c
LOCAL_STATIC_LIBRARIES := EDSDK.lib
include $(BUILD_SHARED_LIBRARY)
LOCAL_ARM_MODE := arm
TARGET_PLATFORM:=android-8
TARGET_ARCH_ABI:=armeabi
TARGET_ABI:=$(TARGET_PLATFORM)-$(TARGET_ARCH_ABI)
$(call import-module,importfile)

but while building this i got error i.e

Android NDK: jni/Android.mk: Cannot find module with tag 'importfile' in import path    
Android NDK: Are you sure your NDK_MODULE_PATH variable is properly defined ?    
Android NDK: The following directories were searched:    
Android NDK: 

please help.

user1465789
  • 21
  • 2
  • 7
  • I think this one should answer your question: http://stackoverflow.com/questions/6942730/android-ndk-how-to-include-android-mk-into-another-android-mk?rq=1 – JonnyBoy Jun 23 '12 at 04:23

2 Answers2

2

Answers to NDK build questions which explicitly use $(LOCAL_PATH) are not correct (I don't know if they were always incorrect, but they definitely do not work for NDK version r8b). You should not prepend paths with $(LOCAL_PATH) - the build system automatically prefixes $(LOCAL_PATH) - hence these scripts prefix LOCAL_PATH twice and fail. This mistake is repeated all over Stack Overflow but I can't go through and correct every answer about the Android build system, so I have posted this in one of the most recent posts on the subject.

I would recommend people answering questions should be using the latest version of the NDK tools, or else qualify their answers with the version they are using.

1

Basically do it like this:

include $(LOCAL_PATH)/libos/Android.mk

This is just normal makefile syntax (See here:http://www.gnu.org/software/make/manual/html_node/Include.html)

JonnyBoy
  • 1,555
  • 14
  • 24