cocos2dx-3.2 running the first Android program

Source: Internet
Author: User

The first step is to download various environments.

Build Android Java Development environment, Android environment (including Adt,eclipse and Android SDK) online has a lot of tutorials, here no longer repeat.

NDK (This is simple, unzip from the official website and then set the decompression path to the path of the environment variable)

ANT (this simple, download from the official website, and then the decompression path +bin This path is set to the environment variable path)

cocos2dx-3.2 (There are a lot of this installation online too)

Python (at the time of installation, after selecting the installation path, there will be a choice to build the interface, the last of the interface is a fork of the default is not installed, the actual is to add the environment variable, the component is also checked on the automatic addition of environment variables)

Installation sequence, Cocos Finally, others casually. ADT, NDK, ant decompression can be.

The second step is to configure the cocos.

The setup.py recommended to run the extracted folder root directory is the command line. Enter a variety of paths (see the corresponding hint, usually the environment variable does not work when you need to manually add the path, followed by the ADT, NDK, Ant directory).

step three, build Android project files

Run command Cocos new project name-P package name-L language (only cpp,lua,js optional)-D project directory

For example: Cocos new Mygame-p com.your_company.mygame-l cpp-d e:\mygame\ This command is to create e:\mygame\ project in Mygame, project package named Com.your_co Mpany.mygame

You'll see the resulting project file in a minute.

In the corresponding project directory, the Proj.android folder has the build_native.py file, which can be automatically compiled into Android project (no need to compile in eclipse with NDK)

Fourth Step, loading the project

Open eclipse, using file->new->other->android/android Project from Existing Code

Choose your project file inside the Proj.android folder, loaded into the only thing, incredibly can not find their own Cocos library, right-->build path->config Build Path looked at its path, incredibly is wrong.

Originally: Project Name \cocos2d\cocos\platform\android\java\src

As a result it is: project name \cocos2d\cocos\2d\platform\android\java\src

This problem took me a long time to find, remove 2d OK, error disappears.

But then there are some errors, according to error one by one after processing off, then run as->android application can be directly compiled to run.

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.