[Android篇]建立一個cocos2D-Android專案

cocos2dx使用版本︰v 2.0.4
cocosBuilder使用版本︰v 2.0 alpha 1

一、前提

如果NDK是放在D槽
請先設定環變
export NDK_ROOT=/cygdrive/d/Android/cygwin/android-ndk-r8

二、步驟

  1. 創立一個cocos2Dx-Android專案

    先下在cocos2Dx目錄底下,
    輸入create-android-project.bat指令
    註︰不能在Cygwin環境下執行。使用前請先將create-android-project.sh和create-android-project.bat裡的預設目錄設好。
  2.  針對這個專案目錄內執行build_native.sh

    創建完後,
    針對這個專案目錄內執行build_native.sh
    即可完成Android專屬的cocos2D專案
    即可使用Eclipse匯入修改。

     3.如果org.cocos2dx目錄遺失

In cocos2d-x 2.0.3 ...Cocos2d-x Lib java files has been considered as a different project only So import that project in the eclipse
Lets make it Simple
  1. First Import the project in eclipse from this path - cocos2d-2.0-x-2.0.3/cocos2dx/platform/android/java
You will see libcocos2dx project in eclipse ...Keep this project open always otherwise your projects will give error on the syntax of library
  1. Run create-android-project
  2. Now Import the project which you have created and just Run (If you know the concept of isLibrary then that's how they are maintaining it now ..)
Also additional information to run build-native.sh from eclipse only , Right Click Project ->C/C++ Build Uncheck Use Default Build COmmand and add following bash ${workspace_loc:/YourProjName}/build_native.sh NDK_DEBUG=1 V=1
Good Luck ..If any question please feel free to ask


三、其它

無法在Visual Studio 2012 Express安裝Cocos2DX template
Editing InstallWizardForVS2012.js located in cocos2D\template\msvc
Line 92, replace vcprojects with vcprojects_WDExpress then run install-templates-msvc.bat and templates will be installed succesfully in VS 2012 Express.
var strDestFolder = FileSys.BuildPath(strValue, "vcprojects_WDExpress");

相關網址︰
1.
2. 跨平臺開發IOS & Android版(中文)
3. 跨平臺開發IOS & Android版(原文)
4. 設定Windows底下的開發環境
5. 建置Cocos2D-X並用Eclipse引入
6. 新建專案後不用COPY一堆Lib的做法
7.

沒有留言 :

張貼留言