Personal Project

Monday, February 29, 2016

How to buld Quick-Cocos2dx-Community for Android and iPhone ?

Build APK for Android


1.Install


    JDK  

        http://www.oracle.com/technetwork/java/javase/downloads/index.html

    Android SDK 

        http://developer.android.com/sdk/installing/index.html?pkg=tools

    Android NDK 9d

        http://dl.google.com/android/ndk/android-ndk-r9-windows-x86_64.zip

    Apache Ant

        http://ant.apache.org/bindownload.cgi



2.Configure environment 


// Change settings for JAVA_HOME, ANT_ROOT,

//  NDK_ROOT, ANDROID_NDK_ROOT

//  ANDROID_SDK_ROOT,  ANDROID_HOME

$ vim ~/.profile

export JAVA_HOME="$(/usr/libexec/java_home)"

# Add environment variable ANT_ROOT for cocos2d-x

export ANT_ROOT=/usr/local/apache-ant/bin

        

# Add environment variable NDK_ROOT for cocos2d-x

export NDK_ROOT=/Users/Tester/Desktop/cocos2dx/android/android-ndk-r9d

export PATH=$NDK_ROOT:$PATH

export ANDROID_NDK_ROOT=/Users/Tester/Desktop/cocos2dx/android/android-ndk-r9d

export PATH=$ANDROID_NDK_ROOT:$PATH

   

# Add environment variable ANDROID_SDK_ROOT for cocos2d-x

export ANDROID_SDK_ROOT=/Users/Tester/Desktop/cocos2dx/android/android-sdk-macosx

export ANDROID_HOME=/Users/Tester/Desktop/cocos2dx/android/android-sdk-macosx

export PATH=$ANDROID_HOME:$PATH

PATH=/usr/local/bin:$PATH:~/bin:~/bin/python:$ANDROID_SDK_ROOT/tools:$ANDROID_SDK_ROOT/platform-tools:$ANT_ROOT:

# Quick cocos2dx

export QUICK_V3_ROOT=`cat ~/.QUICK_V3_ROOT`


3. Create a project named “dev” by player


// Goto Android folder of dev

cd dev/frameworks/runtime-src/proj.android

// clean files

./clean.sh

// Compile  Quick-Cocos2dx-Community Engine Lib and output libcocos2dlua.so

./ build_native.sh

// Update Android Settings

./android update project -p . -t 1

// Set up properties pointing to Quick-Cocos2d-Community folder

// Relative Path

vim project.properties

android.library.reference.1=../../../../../cocos2dx/Quick-Cocos2dx-Community/cocos/platform/android/java


4. Update Android settings in Quick-cocos2dx-Community folder


 cd cocos2dx/Quick-Cocos2dx-Community/cocos/platform/android/java

./android update project -p . -t 1

5.  Build apk and debug


// Goto Android folder of dev

cd dev/frameworks/runtime-src/proj.android

// Build

// Dev mode

ant debug 

// Release

ant release

//  Clean settings

ant clean

// Deploy Apk to Android device

apk is saved in proj.android/bin/dev-debug.apk

cd proj.android/bin/

adb install dev-debug.apk


Build IPA for iPhone


// Goto iPhone project folder

cd dev/frameworks/runtime-src/proj.ios_mac/

// Open xcode project and build ipa

cd dev/frameworks/runtime-src/proj.ios_mac/


1 comment:


  1. I really impressed with this useful post. PHP is an open source programming language; if you begin your career in PHP you can learn coding very simply using internet. There are plenty of communities waiting to resolve your programming doubts. Thanks for sharing the post.
    Regards,
    PHP Training in Chennai

    ReplyDelete