My NDK 9.0,
Andriod SDK 19,
cocos2d-x-3.0-rc0,
Linux build ok, but when run the fellow script in terminal, it goes wrong. How to edit the Andirod.mk file? Thanks for help.
$ python build_native.py
/home/mic/work/hello_project/app/proj.android
jni/../../Classes/HelloWorldScene.cpp:6:36: **fatal error: cocos/network/SocketIO.h: No such file or directory**
#include "cocos/network/SocketIO.h"
^
compilation terminated.
make: *** [obj/local/armeabi/objs/cocos2dcpp_shared/__/__/Classes/HelloWorldScene.o] Error 1
Traceback (most recent call last):
File "/home/mic/work/hello_project/app/proj.android/build_native.py", line 168, in <module>
build(opts.ndk_build_param,opts.android_platform,opts.build_mode)
File "/home/mic/work/hello_project/app/proj.android/build_native.py", line 155, in build
do_build(cocos_root, ndk_root, app_android_root,ndk_build_param,sdk_root,android_platform,build_mode)
File "/home/mic/work/hello_project/app/proj.android/build_native.py", line 91, in do_build
raise Exception("Build dynamic library for project [ " + app_android_root + " ] fails!")
Exception: Build dynamic library for project [ /home/mic/work/hello_project/app/proj.android ] fails!
Ok, I have tried to include this file in my own project and saw the same error.
I was able to fix it by adding the following to jni/Android.mk:
LOCAL_C_INCLUDES += $(LOCAL_PATH)/…/…/cocos2d
however, I think it’s not intended that this be necessary. I think the authors want it to be implied by passing it as NDK_MODULE_PATH to ndk-build, but it’s not working.
@barisatamer
Hi, good news! It is so kind of you that when I modify the file /home/mic/work/ohello_project/proj.android/jni/Android.mk as you have described up, it was passed compiling!
I research the whole day on last weekend in this error, and now, becouse of you, everything is okay, thank you!
(i am a Newbie in cocos2d-x and Andriod… I will write a wiki for configure development evironment in Ubuntu14.04 by KDevelop4.6)
@Ajas
I have to add LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../cocos2d in /home/mic/work/ohello_project/proj.android/jni/Android.mk for compiling passed, too.
Then I find that it was diffirent from #include "network/SocketIO.h" to #include "cocos/network/SocketIO.h", because build_native.py doesn’t provide the path for hello_project/${COCOS2D_ROOT} which the latter method can auto be included of. So, thank you, now it was run on my andriod device!