2014-02-12 52 views
1

我剛剛下載的的Cocos2D-X SDK,並試圖編譯結果如下hello world示例:的Cocos2D-X的編譯錯誤

<code>The Selected NDK toolchain version was 4.8 ! 
Android NDK: WARNING: Ignoring unknown import directory: /home/sytrox/Downloads/cocos2d-x/template/multi-platform-cpp/proj.android/../cocos2d  
Android NDK: WARNING: Ignoring unknown import directory: /home/sytrox/Downloads/cocos2d-x/template/multi-platform-cpp/proj.android/../cocos2d/external  
Android NDK: WARNING: Ignoring unknown import directory: /home/sytrox/Downloads/cocos2d-x/template/multi-platform-cpp/proj.android/../cocos2d/cocos  
Android NDK: jni/Android.mk: Cannot find module with tag '2d' 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:   
make: Entering directory `/home/sytrox/Downloads/cocos2d-x/template/multi-platform-cpp/proj.android' 
jni/Android.mk:22: *** Android NDK: Aborting. . Stop. 
make: Leaving directory `/home/sytrox/Downloads/cocos2d-x/template/multi-platform-cpp/proj.android' 
Traceback (most recent call last): 
    File "./build_native.py", line 166, in <module> 
    build(opts.ndk_build_param,opts.android_platform,opts.build_mode) 
    File "./build_native.py", line 153, in build 
    do_build(cocos_root, ndk_root, app_android_root,ndk_build_param,sdk_root,android_platform,build_mode) 
    File "./build_native.py", line 89, in do_build 
    raise Exception("Build dynamic library for project [ " + app_android_root + " ] fails!") 
Exception: Build dynamic library for project [ /home/sytrox/Downloads/cocos2d-x/template/multi-platform-cpp/proj.android ] fails!</code> 

回答

1

您正在使用哪個的Cocos2D-X的版本?看起來像你沒有正確定義你的env變量。請看看this tutorial並確保定義了以下變量:

  • COCOS2DX_ROOT:應指向的cocos2d-x
  • ANDROID_SDK_ROOT的根目錄下:應指向了Android SDK
  • 的根目錄
  • NDK_ROOT:應指向了Android NDK
  • NDK_TOOLCHAIN_VERSION的根目錄:哪些Android NDK工具鏈應該用
+0

喜,THX您的快速反應。 我正在使用新的測試版2。我從來沒有使用任何其他版本 我會給老的一個機會,因爲我的環境變量都是正確的!? – syc

+0

okey,這些說明僅適用於v3,但它不起作用! – syc

+0

您應該能夠按照官方說明來構建您的項目。如果不是,你可以看看我的帖子[這裏](http://www.pix2d.com/2014/02/build-cocos2d-x-for-android/)。這是我如何設法使用cocos2dx 2.2.1構建android項目,但它也可能對v3有用。 –