Win7 32-bit under COCOS2DX Android development debugging environment

Source: Internet
Author: User

http://blog.csdn.net/dj0379/article/details/38638125

1, use the environment

Win7 32-bit + VS2010

2, software preparation (below the green text with link)

cocos2dx-v2.2.2

Jdk7

Android SDK

Android NDK

ADT Bundle

Ant

Python

Visualgdb

Download good software is (successively):

Cocos2d-x-2.2.2.zip

Jdk-7u5-windows-i586.exe

Installer_r18-windows.exe

Android-ndk-r9d-windows-x86.zip

Adt-bundle-windows-x86-20140321.zip

Apache-ant-1.9.4-bin.zip

Python-2.7.6.msi

Visualgdb.zip

3, Environment installation

A) unzip cocos2dx2.2.2, Adt-bundle,ant, Android NDK to the specified directory, which will need to be used later

b) Install Jdk7

Default installation JDK7, configure the following environment variables

New environment variable: Java_home value: C:\Program files\java\jdk1.7.0_05

New environment variable: CLASSPATH value is:.; %java_home%\lib; (Note: The dot indicates the current directory and cannot be omitted)

Add the following in front of the value of the system variable path:%java_home%\bin; (note: The semicolon here cannot be omitted) here, the JDK is installed.

Click Start, Run, enter: cmd command, enter in cmd window: java-version

The following interface appears, indicating that the installation was successful:

c) Install the Android SDK

The installation will check for JDK installation and will fail if not installed successfully.

Then run SDK Manager.exe to update the SDK (it is recommended to download the corresponding version of the SDK as needed).

Click Install Packages. After completion, for convenience, also configure the environment variable

New environment variable: ANDROID_SDK value: C:\Android sdk\platforms; G:\Android Sdk\tools (This is where the SDK is stored)

In the System PATH environment variable type join:%android_sdk%

Click Start, Run, enter: cmd command, enter in cmd window: adb-h

d) Install python2.7.7

Default installation, add system environment variables as follows

System variable->path add python installation path C:\Python27;

Click Start, Run, enter: cmd command, enter in cmd window: adb-h

e) Install Visualgdb

The default installation is visualgdb for subsequent debugging apk use. After installation, replace the files with the same name in the installation directory with the cracked files in the package, the following menu bar will appear when the installation is completed VS2010

4, compiling Android APK

A) Create an Android test project

The command line enters the cocos2dx2.2.2 directory and enters the following directory: Cocos2d-x-2.2.2\tools\project-creator, execute

Python create_project.py-project helloworld-package test. Helloworld.game-language CPP

Wait patiently, the following results indicate that the creation was successful:

These parameters do not have to explain, the detailed view of the tool description:

To this step a simple COCOS2DX Android has been created, and below we start compiling the project.

b) Compiling Android project

Enter the newly created project, Cocos2d-x-2.2.2\projects\helloworld\proj.android\jni

Edit the Android.mk file and add several paths to the COCOS2DX before Import-module:

[Plain]View Plaincopy
    1. $ (call Import-add-path, e:/programs/cocos2d-x-2.2.2)
    2. $ (call Import-add-path, e:/programs/cocos2d-x-2.2.2/cocos2dx/platform/third_party/android/prebuilt)

Edit Application.mk file Last added, back apk tune try

[Plain]View Plaincopy
    1. App_platform: = ANDROID-17

Return to upper directory, edit androidmanifest.xml file, add tag in <application android:label= "@string/app_name"

[Plain]View Plaincopy
    1. Android:debuggable= "true"

The effect is as follows:

Copy the Org folder under COCOS2D-X-2.2.2\COCOS2DX\PLATFORM\ANDROID\JAVA\SRC to our project, which is cocos2d-x-2.2.2\projects\helloworld\ PROJ.ANDROID\SRC under

c) compiling Android APK file

The time for the chicken to freeze is finally coming, and we're officially starting to compile the apk file for Android.

Find 3 (a) extracted from the Adt-bundle folder, my path name here is adt-bundle-windows-x86-20140321, find the Eclipse folder in it, run Eclipse.exe

If the same as I appear: Failed to create the Java Virtual machine., modify the Eclipse.ini in the directory where Eclipse.exe is located as follows:

Import a new Android project in an open Eclipse, File->new->project->andriod project from Existing Code

Cannot run Program "bash": Launching failed
Error:program "bash" not found in PATH

After opening the default will be compiled error, here we also need to configure, select the project name and then select the Project->properties option,

Modify the configuration as follows:

Modify the Andriod ndk path extracted from the build command to 3 (a)

[Plain]View Plaincopy
    1. E:/software/andriod-cocos2dx/android-ndk-r9d/ndk-build.cmd ndk_debug=1 app_abi= "Armeabi armeabi-v7a"

In this step, the configuration in Eclipse is complete, select the menu item Project->build Project, and then select Run->run as->android application to compile the project apk file.

Get to the engineering Cocos2d-x-2.2.2\projects\helloworld\proj.android\bin and see if there's a apk! on the latest generation.

5, Debug apk

VS2010 Open Project Cocos2d-x-2.2.2\projects\helloworld\proj.win32 under HelloWorld.sln file, configure Android debugging options

After the configuration is complete, we begin to formally debug the APK, which is set in advance where the breakpoint is needed

Attention:

1, the connected phone must be fully rooted, otherwise debug adb error may occur.

2, the developer mode to open, no person may appear to be unable to connect the phone situation.

3, Step 4 (a) Note the version number of Python when creating the project, it is recommended to use the 2.7.7 version, python3.4.1 the above version is not available.

Reference blog:

Http://www.cnblogs.com/lhming/archive/2012/06/27/2566460.html

http://blog.csdn.net/maojudong/article/details/7261986

http://blog.csdn.net/i_am_zw129/article/details/24395875

Win7 32-bit under COCOS2DX Android development debugging environment

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.