cocos2dx在Eclipse下编译报错:Cannot find module with tag 'CocosDenshion/android' in import path

在Eclipse下编译cocos2dx项目,报错如下:

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

请注意Android.mk文件中:

$(call import-module,CocosDenshion/android) \
$(call import-module,cocos2dx) \
$(call import-module,extensions)

这里全部引入cocos2dx根目录下的文件夹,故需要 引入cocos2dx根目录

因此,可以修改proj.android/jni/Android.mk,使用$(call import-add-path....引入cocos2dx路径。

同时,遇到另外一个问题:

Android NDK: WARNING: Ignoring unknown import directory: D:\cocos2d-2.0-x-2.0.4

也就是说,D:\cocos2d-2.0-x-2.0.4  路径不被识别,这个时候,需要将路径的正斜杠修改为反斜杠

完整的引用路径为:

$(call import-add-path,D:/cocos2d-2.0-x-2.0.4)

于是,项目就可以编译了。

我的完整的Android.mk文件是:

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := game_shared

LOCAL_MODULE_FILENAME := libgame

LOCAL_SRC_FILES := hellocpp/main.cpp \
../../Classes/AppDelegate.cpp \
../../Classes/HelloWorldScene.cpp \
../../Classes/PokerScene.cpp \
../../Classes/Poker.cpp \ LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static cocosdenshion_static cocos_extension_static $(call import-add-path,D:/cocos2d-2.0-x-2.0.4)
\
include $(BUILD_SHARED_LIBRARY) $(call import-module,CocosDenshion/android) \
$(call import-module,cocos2dx) \
$(call import-module,extensions)
上一篇:java中的常量池


下一篇:HDU 3622 Bomb Game(2-sat)