Installation and preliminary use of Cocos 2DX

Keywords: Android Google Windows Linux

I. Preparations

Download and install python
 Link: https://www.python.org/downloads/
Note: Configure the environment variables, you can.

II. Installation of Cocos 2DX

1. Download and decompress Cocos 2DX

Download link: http://www.cocos.com/download

Unzip it (PS: The directory should not have Chinese).

Running setup.py directly at this point will prompt the lack of relevant components. Next, we will deal with the components (SDK, NDK, ANT) (need special attention to its path).

2. Download and decompress android sdk

Download link:

Unzipped version of Windows (used this time)
http://dl.google.com/android/android-sdk_r23.0.2-windows.zip
 Windows Installation Edition
http://dl.google.com/android/installer_r23.0.2-windows.exe
 macosx version
http://dl.google.com/android/android-sdk_r23.0.2-macosx.zip
 Linux version
http://dl.google.com/android/android-sdk_r23.0.2-linux.tgz

After downloading the corresponding version, decompress it (PS: path is not available in Chinese), and copy its directory (e.g. D: Program Files android-sdk-windows)

After running setup.py, paste the directory when "Please enter the path of ANDROID_SDK_ROOT<or press Enter to skip>:".

3. Download and decompress android ndk

Download link:

http://dl.google.com/android/ndk/android-ndk32-r10-windows-x86.zip
http://Dl.google.com/android/ndk/android-ndk32-r10-windows-x86_64.zip (for this use)
http://dl.google.com/android/ndk/android-ndk32-r10-darwin-x86.tar.bz2
http://dl.google.com/android/ndk/android-ndk32-r10-darwin-x86_64.tar.bz2
http://dl.google.com/android/ndk/android-ndk32-r10-linux-x86.tar.bz2
http://dl.google.com/android/ndk/android-ndk32-r10-linux-x86_64.tar.bz2
http://dl.google.com/android/ndk/android-ndk64-r10-windows-x86.zip
http://dl.google.com/android/ndk/android-ndk64-r10-windows-x86_64.zip
http://dl.google.com/android/ndk/android-ndk64-r10-darwin-x86.tar.bz2
http://dl.google.com/android/ndk/android-ndk64-r10-darwin-x86_64.tar.bz2
http://dl.google.com/android/ndk/android-ndk64-r10-linux-x86.tar.bz2
http://dl.google.com/android/ndk/android-ndk64-r10-linux-x86_64.tar.bz2
http://dl.google.com/android/ndk/android-ndk-r10-cxx-stl-libs-with-debug-info.zip

//After downloading the corresponding version, decompress it (PS: path is not available in Chinese), and copy its directory (e.g. D: Program Files android-ndk-r10)

//After running setup.py, paste the directory when "Please enter the path of ANDROID_NDK_ROOT<or press Enter to skip>:".

4. Download and unzip apache-ant

Download link:

http://ant.apache.org/bindownload.cgi
//Select: DownLoad - > Binary Distributions - > Current Release of Ant. Select 1.9.8 zip to download.

Be careful

After downloading the corresponding version, decompress it (PS: path is not available in Chinese), and copy its directory (e.g. C: apache-ant-1.9.8 bin) must be the bin directory address in the directory.

After running setup.py, paste the directory when "Please enter the path of ANT_ROOT<or press Enter to skip>:".

Three. Test

After the above three components are configured, please restart the terminal or restart computer to make an added system variable take effect (restart the terminal or restart the computer to make the added system variable take effect).

Open cmd. Enter cocos command after reboot. The installation is successful when the version number appears. If not, please go to the system environment variable force to reset the path names of ndk, SDK and ant.

Create a simple project test.

Create a new app project.

Run cmd and enter cocos new newapp-l cpp-p com.insping-d F: (simply put, "new app" is the name of the project, -p(-package_name) is the name of the specified package com.insping,-l (language) is the specified project language cpp:C++,lua:Lua,js:JavaScript,-d (directory) is the location where the project is stored)

Just wait a moment.

Run the project: cd to the project directory. For example: cd F: newapp
 Input: Cocos run-p win32, you can run.

Posted by Muses on Thu, 21 Mar 2019 21:45:51 -0700