Cocos2d-x lua Study Notes (1) -- Environment Construction

Source: Internet
Author: User

Cocos2d-x lua Study Notes (1) -- Environment Construction

Cocos2d-x 3.0 and later versions of the environment to build and the previous Cocos2d-x 2.0 version of the big difference, at the same time from the Cocos2d-x 3.0 project package into apk Android app files, the steps to build an android environment is a bit cumbersome, however, once it is set up, it will be very quick in the future! OK. Now let's start building the environment!


1. Setting the cocos2d-x environment and setting up the android Environment


1. Download cocos2d-x 3.0 official version


2. Download android sdk and ndk


3. Download ant


(Note: cocos2d-x environment variable configuration requires ant, mainly android needs to use it)

4. Download python 2.7.6 (do not download python or later versions. You do not need to download python or later on your mac)

All the necessary tools have been downloaded. Now we have started to build the environment.

Note: JDK has been configured before, so you do not need to change it.


2. Configure environment variables (ANDROID_SDK_ROOT, NDK_ROOT, ANT_ROOT)


After the download is complete, open the cocos2d-x folder to find the setup. py file, run the console as follows:




In this way, the environment variable configuration is OK. For example:




ANDROID_SDK_ROOT <喎?http: www.bkjia.com kf ware vc " target="_blank" class="keylink"> Vc3Ryb25nPqO6xcy3 + Environment + PHA + Environment + xcy3 + Environment + PHA + Environment + xcy3 + Environment + s7Hkwb/Environment + PGJyIC8 + PC9zdHJvbmc + Environment/Environment + PHA + temperature + temperature/J0tTK7M + kz8LD/temperature/2z8Igu + Gz9s/WyOfPwr3nw + Y6PGJyIC8 + temperature = "http://www.2cto.com/uploadfile/Collfiles/20140930/20140930092213143.png" alt = "\"/>


Here we can see that the cocos. py script can execute four commands. The role of each command is clearly described.

Next, we will use the new command to create our project:Cocos new-p com. game. simple-l lua-d e: \ simple




After the creation is successful,




Press shift Key + Right-click to open the command window here, and enter cocos run-p win32 to compile and run the win32 platform.




Everyone is familiar with it. ^


3.2 Create an android platform


Like creating win32, press the shift Key + right-click and choose "platform processing" to open the command window and enter: cocos compile-p android -- ap 20 is used to compile the APK file (-- ap 20 is the android platform), and the real machine is inserted at the same time. After the compilation is successful:




Open the binfile of the android platform and we can see that cocos2dx helped me generate the project *. apk, and debug log files,



If you want to perform further debugging, You can import eclipse and real machine debugging.

Note: Here is a small detail, version 3.2 uses android-20, if the drive letter: \ adt-bundle-windows-x86_64-20140321 \ sdk \ platforms directory does not have android-20, please create an empty,




Check whether project. properties in the \ proj. android directory is android-20,




Well, the development environment has been set up, and then began to formally learn cocos2d-x lua.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.