当前位置: 代码迷 >> Android >> cocos2d-x jni 有关问题!
  详细解决方案

cocos2d-x jni 有关问题!

热度:197   发布时间:2016-05-01 12:35:14.0
cocos2d-x jni 问题求助!!!
本帖最后由 qqxj2012 于 2012-11-30 15:55:46 编辑 在jni文件夹下:
Andriod.mk文件内容如下:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)

subdirs := $(addprefix $(LOCAL_PATH)/../../../,$(addsuffix /Android.mk, \
           Box2D\
           cocos2dx\
           CocosDenshion/android\
))
subdirs += $(LOCAL_PATH)/helloworld/Android.mk

include $(subdirs)
Application.mk文件内容如下:
APP_STL := stlport_static
APP_MODULES := cocos2d box2d cocosdenshion game

在jni/helloworld文件夹Andriod.mk内容如下:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := game

LOCAL_SRC_FILES := main.cpp \
../../../Classes/AppDelegate.cpp \
../../../Classes/MainMenuScene.cpp

LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../../../cocos2dx \
                    $(LOCAL_PATH)/../../../../cocos2dx/platform \
                    $(LOCAL_PATH)/../../../../cocos2dx/include \
                    $(LOCAL_PATH)/../../../../CocosDenshion/include \
                    $(LOCAL_PATH)/../../../Box2D \
                    $(LOCAL_PATH)/../../..\
                    $(LOCAL_PATH)/../../../Classes 


# it is used for ndk-r7  
# if you build with ndk-r4, comment it  
# because the new Windows toolchain doesn't support Cygwin's drive
# mapping (i.e /cygdrive/c/ instead of C:/)  
LOCAL_LDLIBS := -L$(call host-path, $(LOCAL_PATH)/../../libs/armeabi) \
                -lcocos2d -llog -lcocosdenshion \
                -lbox2d \
                -L$(call host-path, $(LOCAL_PATH)/../../../../cocos2dx/platform/third_party/android/libraries) -lcurl
            
include $(BUILD_SHARED_LIBRARY)


最后eclipse 报错如下:
jni/Android.mk:11: jni/../../../Box2D/Android.mk: No such file or directory
jni/Android.mk:11: jni/../../../cocos2dx/Android.mk: No such file or directory
jni/Android.mk:11: jni/../../../CocosDenshion/android/Android.mk: No such file or directory

我百度谷歌了好多博客,我尝试将用到的.h  .cpp文件和Android.mk都放到jni文件夹下:
编译后才开始有如下内容:
Gdbserver      : [arm-linux-androideabi-4.4.3] libs/armeabi/gdbserver

Gdbsetup       : libs/armeabi/gdb.setup

"Compile++ thumb : game <= main.cpp
jni/main.cpp:1:25: error: AppDelegate.h: No such file or directory