Search code examples
androidmakefilecocos2d-x

MAKE problems in Android Project enabled with cocos2dx - "No rule to make target"?


BACKGROUND: I'm following a tutorial online: Game apps in Android by Todd Perkins - It's been very straightforward other than the hiccups that come with setting up NDK with eclipse, which I've managed to solve.

Problem: I'm stuck at the point where I want my cocos2dx code to respond to a touch event and based on that, call Java android code from an activity.

I've added a bunch of screen shots below to show you how I've set everything up:

When I run build_native.sh:

enter image description here

Now I've made sure that I've linked my folders correctly in the project.

Below is a screen shot of the "linked" JNI folder(jni_linked), along with JniURL.cpp and JniURL.h:

enter image description here

and here's what my Android.mk file looks like:

enter image description here

I've double/triple checked the path of my Jni folder and it is:

C:\Users\DarkRaveDev\Documents\cocos2d-x-2.0.1\cocos2dx\platform\android\jni

Do I need to change the Android.mk file to have this line:

LOCAL_SRC_FILES := helloworld/main.cpp \
               ../../Classes/AppDelegate.cpp \
               ../../jni_linked/JniURL.cpp \
               ../../Classes/HelloWorldScene.cpp

Solution

  • It's probably treating:

    /../../../cocos2dx/platform/android/jni/JniURL.cpp \
    

    as starting with an absolute path instead of a relative path. It probably should be:

    $(LOCAL_PATH)/../../../cocos2dx/platform/android/jni/JniURL.cpp \
    

    or maybe:

    ../../../cocos2dx/platform/android/jni/JniURL.cpp \