user2212461
user2212461

Reputation: 3263

How to build Android NDK cocos2d-x project from within Eclipse?

I set up an Android project that uses cocos2d-x. Now I want to build the project in Eclipse but I get the build error

Android NDK: jni/Android.mk: Cannot find module with tag '.' 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:

Which means that my library was not built.

I'm using the Android.mk file as in the templates of cocos2d:

Android.mk:

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := my-library
LOCAL_C_INCLUDES := /home/me/cocos2d-x-3.4 \
                    /home/me/cocos2d-x-3.4/extensions \
                    /home/me/cocos2d-x-3.4/cocos/editor-support
LOCAL_SRC_FILES := main.cpp \
                   AppDelegate.cpp              
LOCAL_LDLIBS := -llog
LOCAL_STATIC_LIBRARIES := cocos2dx_static
include $(BUILD_SHARED_LIBRARY)

$(call import-module,.)

The ndk path is set correctly for the project. How can I build my cocos2d-x project correctly when using Eclipse?

Upvotes: 0

Views: 1605

Answers (1)

Mohak Agarwal
Mohak Agarwal

Reputation: 26

The following procedure worked for me:

  1. Goto Eclipse/ADT preferences.
  2. Then C/C++ -> Build -> Envionment
  3. Click on Add.
  4. Put NDK_ROOT in Name and path of NDK under Value.
  5. Now try to build it from eclipse, if it doesn't work, then Repeat the procedure and this time put NDK_MODULE_PATH under Name.

Upvotes: 1

Related Questions