In Windows 7 environment to build a Cocos2d-x3.3 environment and configure the android cross compiling environment, cocos2dx3.3

Source: Internet
Author: User
Tags windows x86

In Windows 7 environment to build a Cocos2d-x3.3 environment and configure the android cross compiling environment, cocos2dx3.3
 This article describes how to build Cocos2d-x VS2013 and Android Development Environment on Windows 7 platform. A computer equipped with Windows 7 platform and Visual Studio 2012/2013 must be installed. It is best to have a fast and stable network, because many software packages need to be downloaded during operations. In addition, it is recommended that the computer be better. Otherwise, compilation will be very time-consuming.

I. computer environment

Win7 + 32-bit


Ii. Required software and versions

1. Eclipse

: Http://www.eclipse.org/downloads/

The author uses the version Luna (the latest version of Mars, officially released on December 31, June 24, 2015). Remember the number of digits on your computer.


2. Java JDK

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

The version used by the author: 1.8 (the latest version). After going in, Windows x86 is a 32-bit system.


3. android-sdk

: Http://dl.google.com/android/android-sdk_r23.0.2-windows.zip

Version used by the author: r23


4. android-ndk

: Http://dl.google.com/android/ndk/android-ndk32-r10-windows-x86.zip

Version used by the author: r10


5. cocos2d-x

: Http://cn.cocos2d-x.org/download/

Version used by the author: V3.3 Final


6. VS2013

: Http://www.iplaysoft.com/vs2013.html


Iii. software installation and configuration

1. install and configure Java JDK

(1) installation: Click exe to install

After the installation is successful, test whether the installation is successful. Click Start> RUN> CMD, enter Java-version in the command prompt, and press Enter, the installation is successful.


Note: The Java JDK must be installed, or the Java program cannot run.

(2) Configuration:

Next, start configuring environment variables, right-click computer> Properties> advanced system Settings> advanced> environment variables ],

Select create system variable. In the new System variable dialog box that appears, enter JAVA_HOME in the variable name text box and enter the JDK installation path in the variable value text box, click OK.


In the "System variables" option area, check the PATH variable. If it does not exist, create a new variable PATH. Otherwise, select the variable and click "edit, add "% JAVA_HOME % \ bin; % JAVA_HOME % \ jre \ bin;" or directly "% JAVA_HOME % \ bin;" to the start position of the variable value text box, and click OK.


Check the CLASSPATH variable in the "System variables" option area. If the CLASSPATH variable does not exist, create the CLASSPATH variable. Otherwise, select the variable and click "edit, add "." To the start position of the variable value text box. % JAVA_HOME % \ lib \ dt. jar; % JAVA_HOME % \ lib \ tools. jar ;"


Check whether the environment variable is successfully configured. Enter "JAVAC" in the doscommand line window, and the output help information is correctly configured.



2. Install Eclipse

Installation: directly decompress the package.

3. ADT Installation

(1) installation: Open Eclipse and choose "help"> "install new software" from the menu"



Go to the installation page, add address: http://dl-ssl.google.com/android/eclipse,



All the way to the next step, after the installation is complete, the software will automatically prompt to restart, just follow the operation.

3. android-sdk installation and configuration

(1) installation: just decompress the package to the directory. My path is D: \ Program Files \ Android \ android-sdk.


Use: Double-click SDK Manager.exe in the installation directory to install and download the SDK Platform package, and select to download the corresponding package based on the android version you need to develop.

Generally, the following error occurs. If not, it may be because you are abroad.


Open the hosts file in C: \ WINDOWS \ system32 \ drivers \ etc

Add:

203.208.46.146 www.google.com

74.125.113.121 2.16.android.com

203.208.46.146 dl.google.com

203.208.46.146 dl-ssl.google.com

Save and select the SDK version you want.


Then Install 18 packages. The subsequent operations are simple. It will automatically download to your installation directory D: \ Program Files \ Android \ android-sdk (this is my)

(2) install and configure the SDK (android-sdk)

After downloading it, you cannot directly use it. We configure it in Eclipse.

Open Eclipse and choose "Window"> "first item" ("Window"> "Preferences ")


Select Android on the left and SDK Location on the right.

Now, the android-sdk is ready. Now, you can develop Android apps.

------------------------------ All the above are actually the construction of Android development goggles ------------------------------------


4. android-ndk installation and configuration

(1) installation: just extract to the directory is good, my path is: D: \ android-ndk32-r10-windows-x86

(2) configuration: Go to "Window"-> "first item" ("Window"-> "Preferences") in the menu, expand the left-side Android interface, and select the NDK

Problem: If ndk is configured in eclipse but no configuration options are found,

Solution 1: You need the NDK plug-in (com. android. ide. eclipse. ndk_23.0.2.1259578.jar), place it in eclipse/plugins, and restart it.

Solution 2: "Help"-> "install new software", add, enter http://dl-ssl.google.com/android/eclipse

Select Android Native Developer Tools.

Then open the "Window"-> "first item" ("Window"-> "Preferences") and enter the NDK directory.



5. Python installation and configuration

(1) installation: use the default installation method when installing python. My path is C: \ Python27.

(2) configuration: Configure environment variables on my computer (right-click) -> properties-> advanced system settings-> Advanced tab-> environment variables-> system variables find the Path variable and add the environment variable pointing to Python in its value. The format is [Python installation path]. For example, the environment variable I installed on drive C is added to C: \ Python27;


4. VS2013 use cocos2d-x

1, cocos2d-x-3.3 Installation

Cocos2d-x-3.3 projects do not require installation, download the cocos2d-x-3.3 and unzip it, open the build directory, and double-click to run the cocos2d-win32.vc2012.sln solution.

Set the project you want to run as a startup Item and click Run.


If everything is normal, you will get the following interface. Congratulations! You have successfully run a Cocos2d-x on Windows 7 platform.

(Compilation is really a long process !!)


(This is version 2. x .. I'm too lazy to wait .... The computer really got stuck with me .... I will try again later)

2. Create a project

Go to Directory D: \ cocos2d-x-3.3 \ tools \ cocos2d-console \ bin

Open the terminal and run the cocos. py script to create a file.

// 
 python cocos.py new HelloCpp -p com.coco2dx.org -l cpp -d ~/Desktop
//

Parameter description:

HelloCpp project name

-P: Next package name

-L followed by development language types, including cpp, lua, and js

-D directory to which the project is stored

View the D: \ cocos2d-x-3.3 \ tools \ cocos2d-console \ bin project path and you will find the new HelloCpp project appears in the directory. In turn, open the "HelloCpp/proj. win32" folder, "HelloCpp. sln" solution, and click Run project. If the following interface appears, the project is successfully created.

(Compilation is really a long process !!)


5. cocos2d-x for Android

1. generate an Android project file

Before that, remember to add the ring mirror variable NDK_ROOT, and then the path is your installation directory.


And ANDROID_SDK_ROOT: Then the path is your installation directory


Run the build_native.py script under proj. android to compile the test project. (Next tutorial)

python build_native.py

(Wait for a while ...............)

2. Import the Android Project

Finally, you can start Eclipse and import the Android project. The procedure is as follows:

-- Right-click Package Explorer and select Import ..."

-- In the displayed dialog box, select "Exsiting Android project into workspace" (import an existing Android project to the workspace ).



Then it is a long process ..........


The project reports an error because there is no library file that references the Cocos2d-x

Solution: Right-click the project and choose Properties> Android to pull to the bottom.

Remove the library file path with the error reported,

Follow the above method to import to Eclipse. Set your mobile phone to debug mode and connect to your computer with a USB cable. Run test in Eclipse and you will be able to see the HelloWorld running on your mobile phone!


Reprinted please indicate the source: http://blog.csdn.net/evankaka/article/details/43114651








Related Article

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.