Cocos2d-x for Android: Ubuntu Environment Construction

Source: Internet
Author: User

Http://www.cnblogs.com/TerryBlog/archive/2012/10/27/2742501.html

Cocos2d-x for Android: Ubuntu Environment Construction

By Terry _ dragon, 1986 reading, 0 comments, favorites, editing

After experiencing the power of VIM, it seems that a development program does not consciously need this product, and it also tends to develop applications under Ubuntu. I had nothing to do over the weekend. I looked at cocos2d and thought that I had entered the game industry. So, install it.

Cocos2d-x engine download

Click to download or git: // github.com/cocos2d/cocos2d-x.git

 

After the download is complete, decompress the package and obtain the following directory:

 

Step 1

Open the create-android-project.sh script and change ndk_root_local and android_sdk_root_local to the ndk directory and SDK directory corresponding to your system, such

 

Save the changes.

Run the create-android-project.sh script to generate the android project. Enter the game project package name, project name, and target version to be generated as prompted. This is not described too much.

 

Step 2

After the code is generated, you will see the project named "project name" in the "cocos2d" directory, for example, "mycocos2d" in the preceding directory. The three directories will be displayed, if the other two directories do not work for the time being, directly go to proj. android directory, as shown in the following list

 

 

If you have declared the ndk directory before installing the ndk, you can directly execute the build_native.sh script (provided that the Declaration is marked by ndk_root ). If the statement is not declared, the prompt Please define ndk_root is displayed.

TIPS: the Declaration is very easy to add and source on. bashrc, or directly export ndk_root = [your target ndk_root].

Whether the verification is successful or not can be like this: CD $ ndk_root, It will be successful if it enters, if it does not enter, Please carefully check whether the path is correct.

Well, let's not talk about it. After completing the above steps, you can directly execute build_native.sh.

 

Step 3

If Step 2 is successfully executed, you can open your eclipse and add the project you just generated to Eclipse IDE, the Org. cocos2dx. lib. cocos2dxactivity. As a result, when I load the project, I will prompt that no package can be found. I checked a lot online and did not find a specific solution. If you want to know it, you can tell me the solution.

Directly go to the following directory:

 

Copy the Java library of the corresponding Android platform in the src directory to the project I generated. Of course, you can also export it to a jar file, so that you do not need to copy it to every project, this is a two-way solution provided by me. Please give some advice from experts on the Internet. If the solution is generated, you can directly let eclipse identify it.

This is my project. properties file.

 

 

Taste fresh

After a hard time, you can start to see the results of our efforts and run the project on your mobile phone to see the results.

 

 

Good luck.

 

 

After experiencing the power of VIM, it seems that a development program does not consciously need this product, and it also tends to develop applications under Ubuntu. I had nothing to do over the weekend. I looked at cocos2d and thought that I had entered the game industry. So, install it.

Cocos2d-x engine download

Click to download or git: // github.com/cocos2d/cocos2d-x.git

 

After the download is complete, decompress the package and obtain the following directory:

 

Step 1

Open the create-android-project.sh script and change ndk_root_local and android_sdk_root_local to the ndk directory and SDK directory corresponding to your system, such

 

Save the changes.

Run the create-android-project.sh script to generate the android project. Enter the game project package name, project name, and target version to be generated as prompted. This is not described too much.

 

Step 2

After the code is generated, you will see the project named "project name" in the "cocos2d" directory, for example, "mycocos2d" in the preceding directory. The three directories will be displayed, if the other two directories do not work for the time being, directly go to proj. android directory, as shown in the following list

 

 

If you have declared the ndk directory before installing the ndk, you can directly execute the build_native.sh script (provided that the Declaration is marked by ndk_root ). If the statement is not declared, the prompt Please define ndk_root is displayed.

TIPS: the Declaration is very easy to add and source on. bashrc, or directly export ndk_root = [your target ndk_root].

Whether the verification is successful or not can be like this: CD $ ndk_root, It will be successful if it enters, if it does not enter, Please carefully check whether the path is correct.

Well, let's not talk about it. After completing the above steps, you can directly execute build_native.sh.

 

Step 3

If Step 2 is successfully executed, you can open your eclipse and add the project you just generated to Eclipse IDE, the Org. cocos2dx. lib. cocos2dxactivity. As a result, when I load the project, I will prompt that no package can be found. I checked a lot online and did not find a specific solution. If you want to know it, you can tell me the solution.

Directly go to the following directory:

 

Copy the Java library of the corresponding Android platform in the src directory to the project I generated. Of course, you can also export it to a jar file, so that you do not need to copy it to every project, this is a two-way solution provided by me. Please give some advice from experts on the Internet. If the solution is generated, you can directly let eclipse identify it.

This is my project. properties file.

 

 

Taste fresh

After a hard time, you can start to see the results of our efforts and run the project on your mobile phone to see the results.

 

 

Good luck.

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.