cocos 1.0 preview 遇到的问题

前端之家收集整理的这篇文章主要介绍了cocos 1.0 preview 遇到的问题前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

============================================================
博文原创,转载请声明出处
============================================================



在ios上运行没啥问题,在Android出问题不少。

1、编译遇到下面问题

**** Build of configuration Release for project test3 ****

python /Users/yangeric/mCocos/test3/proj.android/build_native.py -b release all 
Android NDK: WARNING: Ignoring unknown import directory: jni/../../cocos2d    
Android NDK: WARNING: Ignoring unknown import directory: jni/../../cocos2d/external    
jni/Android.mk:25: *** Android NDK: Aborting.    .  Stop.
Android NDK: WARNING: Ignoring unknown import directory: jni/../../cocos2d/cocos    
Android NDK: jni/Android.mk: Cannot find module with tag './prebuilt-mk' in import path    
Traceback (most recent call last):
  File "/Users/yangeric/mCocos/test3/proj.android/build_native.py",line 159,in <module>
    build(opts.ndk_build_param,opts.android_platform,opts.build_mode)
  File "/Users/yangeric/mCocos/test3/proj.android/build_native.py",line 146,in build
    do_build(cocos_root,ndk_root,app_android_root,ndk_build_param,sdk_root,android_platform,build_mode)
Android NDK: Are you sure your NDK_MODULE_PATH variable is properly defined ?    
Android NDK: The following directories were searched:    
Android NDK:         
  File "/Users/yangeric/mCocos/test3/proj.android/build_native.py",line 82,in do_build
make: Entering directory `/Users/yangeric/mCocos/test3/proj.android'
make: Leaving directory `/Users/yangeric/mCocos/test3/proj.android'
The Selected NDK toolchain version was 4.8 !
    raise Exception("Build dynamic library for project [ " + app_android_root + " ] fails!")
Exception: Build dynamic library for project [ /Users/yangeric/mCocos/test3/proj.android ] fails!

**** Build Finished ****


修改

test3/proj.android/jni/Android.mk

编辑.mk文件,这一段
$(call import-add-path,$(LOCAL_PATH)/../../cocos2d)
$(call import-add-path,$(LOCAL_PATH)/../../cocos2d/external)
$(call import-add-path,$(LOCAL_PATH)/../../cocos2d/cocos)
替换为
$(call import-add-path,/Applications/Cocos/frameworks/cocos2d-x/)
$(call import-add-path,/Applications/Cocos/frameworks/cocos2d-x/external)
$(call import-add-path,/Applications/Cocos/frameworks/cocos2d-x/cocos)

2、ok,接上面,继续运行,app 会crash,

logcat为

11-03 13:27:31.565: A/libc(21894): Fatal signal 11 (SIGSEGV) at 0x00000178 (code=1),thread 21910 (Thread-3932)


修改

test3/proj.android/build_native.py

查找下面一行
resources_dir = os.path.join(app_android_root,"../Resources")

改为
resources_dir = os.path.join(app_android_root,"../res")
ok,运行ok了 原文链接:https://www.f2er.com/cocos2dx/346453.html

猜你在找的Cocos2d-x相关文章