Cocos2d-x learning in Windows 7 Android Environment Construction

Source: Internet
Author: User
Tags windows x64 windows x86

Android platform Project Creation

1. Android SDK + ndk Installation

1) install Java JDK. (If you have already installed JDK, skip this step)

Go to: http://www.oracle.com/technetwork/java/javase/downloads/index.html or click Download. For example

Select JDK download (JRE is not required for Android Development)

For 32-bit Windows 7, select windows x86, and 64-bit Windows 7 select windows x64.

After installation, configure the environment variables:

Create an environment variable: java_home; Value: D: \ Program Files \ Java \ jdk1.7.0

New Environment Variable: classpath value: ..; % java_home % \ Lib; (Note: The dot number indicates the current directory and cannot be omitted)

Add the following content before the system variable PATH value: % java_home % \ bin; (Note: The semicolon here cannot be omitted) Here, JDK installation is complete.

Click Start> Run, enter the CMD command, and enter Java-version in the CMD window.
If the following interface is displayed, the installation is successful:

2) download eclipse

Go to the following page:

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

Select windows 32-bit for download. Unzip the package and open it directly.

3) install Android SDK and ndk

Go to the following page http://developer.android.com/sdk/index.html

Or directly copy this address to download: http://dl.google.com/android/installer_r18-windows.exe

Open installer_r18-windows.exe

JDK installation will be checked during installation. If the installation fails, the installation will fail.

Then run SDK manager.exe to update the SDK (we recommend that you download the corresponding SDK version as needed ).

Install packages. Then, configure the environment variables for convenience.

New Environment Variable: android_sdk value: G: \ Android SDK \ platforms; G: \ Android SDK \ tools (this is the location where the SDK is stored)

Add % android_sdk % to the System Path Environment Variable type

Click Start> Run, enter the CMD command, and enter ADB-H in the CMD window.

Enter the http://developer.android.com/tools/sdk/ndk/index.html or click to download directly

Download unzip to E: \ android-ndk-r8

Android ndk includes build, Docs, samples, sources, gnumakefile, ndk-build, ndk-GDB, and readme.

2. cygwin Installation

Most ndk development involves compiling and running C/C ++ in the GCC environment, so in the Windows environment, you need to simulate the Linux compiling environment ,:

Http://www.cygwin.com/

Download a setup.exe file. The process is as follows:

Step 1: run SetupProgramClick Next to go to the next step.

Step 2: select the installation method. You can use direct connection to download and install the package online for the first time. If you have a ready-made offline package, you can select install from local directory ).

Step 3: select the installation directory, such as c: \ cygwin. Note that this directory refers to the final installation directory of cygwin, rather than the temporary directory for downloading files.

Step 4: set the path for saving local packages

The temporary directory is stored in the same directory of setup.exe. The downloaded directory is in the format of FTP % 3A % 2f % 2fcygwin.mirrors.pair.com % 2f.

Step 5: Set the network connection mode

Step 6: select the download site address

At first, I tried to check which address is used for the fast speed (if it doesn't feel fast, I 'd like to cancel it and try again ).

Step 7: Wait for the installation item to load and select the installation item

We compile ndk. Under the default settings, we only need to select devel (Click devel in the list and change default to install, as shown by the arrow in the figure). The other options are default. (In fact, ndk does not need much, mainly autoconf2.1, automake1.10, binutils, GCC-core, GCC -, g ++, gcc4-core, gcc4-g ++, GDB, PCRE, PCRE-devel, gawk, make)

Step 8: wait until the download is complete

The download completion time is determined by the number of installation packages you selected and the network connection speed. For example, according to the default method in this article, it may take 2-3 hours (depending on the network speed). After the download, the compressed package is about 1.2 GB, after the download is complete, it is automatically installed in the installation directory set above.

Reminder: after the first download is complete, you 'd better back up the downloaded package directory. You can directly use the offline Installation Method for the next installation of the same environment (select local installation in step 2 ).

Run cygwin. In the displayed command line window, enter the cygcheck-C cygwin command to print the current cygwin version and running status. If the status is OK, cygwin runs normally.

Enter gcc-V, G ++ -- version, make-version, and GDB-version in sequence for testing. (note the space and-) if both print the published information and some description information, this indicates that cygwin is successfully installed.

3. Install ADT and configure cygwin

1. Install the android development plug-in

(1) Open eclipse and choose help> install new software on the menu bar. The following page is displayed:

Click Add. The following page is displayed.

Enter URL: https://dl-ssl.google.com/android/eclipse/ (Change HTTPS to HTTP if an error occurs)

Name: Android (which can be customized here)

Click OK. The following page is displayed.

Select All.

Click Next. The following page is displayed:

Click Next. The following page is displayed:

Select I accept the terms of the license agreements and click Next To Go To The plug-in installation page.

After the installation is complete, the following page appears:

Click Yes to restart eclipse.

Choose WINDOW> preferences to go to the following page:

Select the decompressed directory of your android SDK (ADT 18 will scan your computer by default, find and configure the SDK location ).

If the SDK is not installed, you can choose Window> Android SDK and AVD manager from eclipse to display the following interface:

You can also select the desired SDK version.

Create an AVD (Android vitural device). Enter the android SDK and AVD manager, select vitural devices, and click the new button.

Click the new button to go to the following page:

The name can be retrieved as needed. Select the desired SDK version for target and customize the SD card size. Click Create AVD to create the SDK.

Configure cygwin

Enter the cygwin directory in the command line and run cygwin. bat. If you are not using the Administrator account to log on to the system, a new folder named after your login name will be generated in the cygwin \ home \ folder.

Modify the new ". bash_profile" file in the folder, open it in a text editor such as UE or editplus, and add at last: (E/android-ndk-r8-windows/android-ndk-r8 is the path to install ndk)

Ndk_root =/cygdrive/e/android-ndk-r8-windows/android-ndk-r8

Export ndk_root

Save and close.

 

So far we have basically built the cocos2d-x Windows 7 Android environment, the next section we will begin to create cocos2d-x Android platform Hello World project.

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.