Cocos2d-x 3.x full Platform Novice development configuration tutorial

Source: Internet
Author: User
Tags macbook

This article for Cocos2d-x 3.x full platform (Android,ios) Novice Development Configuration Tutorial Raiders, I hope to help you. Because this article is facing the novice. So some places will be more verbose, please do not take offense. If there is an error in the tutorial, please correct it. If you are having problems configuring your development platform, you are welcome to discuss them.

The environment used in this article is PC (Win7), HTC g18,macbook Air and Mini IPad. I. GENERAL preparatory work 1, install Cocos2d-x 3.1Download the Cocos2d-x 3.1 engine on the COCOS2D website and unzip it after downloading. 2. Install Eclipse and Android SDKThis can be common on Mac or PC development. Eclipse is available on its website (website address). Android SDK in Android Developer Center Download (address). Eclipse is the IDE you need to develop Android. This is a very good IDE, there are a lot of plugins to make him become three heads. To develop Android programs, you need to download the relevant plug-ins, but if each plugin to configure themselves, it will be very painful things. If you are a novice, it is recommended to use: ADT Bundle. This is the Eclipse+android SDK, and all the projects have been configured for you. 3. Installing the JDKEclipse requires a Java environment to run. If the Java environment is not installed beforehand, an error will be given. Solution to install the JDK (). In general, environment variables are automatically configured after installation. If you haven't solved the problem, find out more about the JDK installation on your network. 4. Installing the CDT plugin() This is a plug-in for eclipse that supports the development of the C + + language in Eclipse. Download from Eclipse's official website, after downloading, copy the contents of features and Plusins folders to the corresponding folder in the Ecplise installation directory. 5. Installing the NDK() This is a necessary tool for mixed compilation of C + + and Java. Make a note of the directory that was extracted after the download, as it will be used in subsequent installations. 6. Install Ant() Cocos Android development needs to use it, so download it and install it. Second, the PC environment configuration process 1, installation VS2012(official address) There are many other online. The best is 2012, I have tried 2010,2013, will have such a problem. So, 2012! 2. Install Python 2.7.6() because the Cocos2d-x installer is written in Phthon, this software is required. Do not download the version above python3.0, otherwise the operation will be wrong. If it's a Mac, then you're born with it. 3, the development environment configurationOnce the above work has been completed, it can be configured. Start the Windows command-line (CMD) tool. Enter the installation directory for Cocos2d-x 3.1 to perform:
    1. Python setup.py
Cocos2d-x version 3.1 uses this setup.py to install, very convenient. After execution, you will be configured to install the ANT, NDK, SDK, and so on, where you can install it and enter it. 4. Build Your own projectWith setup.py configured cocos2d-x environment, your command line will be more like "cocos" command, the new project will use this command. Example:
    1. Cocos New Hello (project name)-P Com.hello (package name)-L CPP (project type)-D E:\MyCocos\cocos2d (directory)
The new project will copy all the source files and libraries to your project directory. So the new project file will be very large, there are many people doubt the necessity of this, but in your development later will know that this configuration method is right. Once the project is established, you can develop: A, the development of VS2012. Find your project directory under: Proj.win32, open the solution on the line. The rest is your mission. In general, you can run it directly. B, the development of Android. Use the project import in Eclipse to import the project schema in Proj.android. After the import, because the SDK problem, generally cannot start, about this problem, as well as other problems, see (iv, other problem solution). Third, the configuration process in Mac environment 1. Sign up for Apple Developer account(registered address) If you do not use the real machine, debugging with the simulator, then the developer account should be sufficient. If you want to use real-machine debugging, you need to purchase iOS developer membership for 688RMB a year. I saw before the Raiders said 99 dollars, but look at the current page of the hint, should be as long as there is net silver can pay. Online Raiders write very complex, said to download the certificate what what, now all do not need, xcode all for you to do, as long as prompted all the way to agree on the line. 2. Install XcodeThere is a download of Xcode under your developer homepage. Download the installation from the App Store. Please use the latest Xcode (requires OS X 10.8 or more system support) and install it using the App Store. My MacBook Air is still 10.7 when it comes from a friend, because the download is always interrupted and repeatedly unsuccessful, so with Xcode 4.6, it doesn't seem to be a problem with the App Store installation. Therefore, it is highly recommended to use the latest version. 3, the developer environment configuration. As with the configuration of the PC, open the terminal program of the Mac, execute the setup.py, and configure the path of the various SDKs. But the Mac needs to add one more sentence:
    1. Source/users/yourname/.bash_profile
This is used to refresh the configuration file. 4. Establish project documentsSet up using the command line. If you're like me, with two platforms (PC and Mac), you can share the same project directory. My project files are placed on a PC, and Mac accesses project files through sharing. After the project is established, it can be developed. The configuration under the Mac is relatively straightforward, using Xcode to open the project configuration file under Proj.ios_mac under Project directory. After that, there is basically no error. Iv. Other problem solving solutions Eclipse is related to Android:Issue: SDK error because cocos2d-x template defaults to using Android 2.3.3 (API-10), if the newly installed ADT bundle or Android SDK is API-19, then an error will occur, the solution is via Android The SDK Manager downloads the SDK for Android 2.3.3. Issue: Project ' XXX ' is missing required source folder: ' Gen ' This issue is caused by the SDK error above. Problem: Undefined reference to ' cocos2d::network::httpclient::getinstance () ' I was using the network library when this error occurred. If you use a different library, the solution is the same. The reason is that a reference to the library is missing. The solution is added in android.mk: local_whole_static_libraries + = Cocos_network_ Staticcocos2d-x developers have added a lot of this path to ANDROID.MK, which is usually commented out. Add these to the line when you want to use them. Issue: Fatal error:cocos-ext.h:no such file or directory problem analysis: Missing header file path references need to add local_c_includes + = $ (Local_path) in: android.mk )/.. /.. /cocos2d/extensionscocos2d-x developers have added a lot of this path to ANDROID.MK, which is usually commented out. Add these to the line when you want to use them. Question: The import org.cocos2dx.lib cannot be resolved. The specified library file could not be found. The solution is to add a reference to the path: Project Properties, Java Build Path, Source and then linking "Projects directory/COCOS/PLATFORM/ANDROID/JAVA/SR C VS2012 Related:Issue: "Extensions/extensionmacros.h": No such file or directory cannot open include files. 1. In the solution, add "existing project"--libextensions specific directory:. \cocos2d\extensions\proj.win32\libextensions.vcxproj2, add reference-->LIBEXTENSIONS3 in Project, pass: Property->c/c++-> additional include directory. Additional Include Directories: $ (engineroot) If you use other files, the solution is the same. 1. Add a reference to the project. 2. Include directories for additional header files. Xcode Related:Question: Contacting Your reference because I originally registered the Apple ID and the developer account name is different, so after paying the developer member, cannot verify passes. This prompt appears. The solution is to contact Apple Developer Service: 400 670 1855. The customer service will help you identify your identity and solve the problem. Other Tips article:If there is not clear, you can refer to the following guide article, basically I also rely on these articles to solve the problem: How to Debug and publish online iOS program Eclipse run cocos2d-x-3 Project Ultimate Solution Cocos2d-x 3.0 full version and Android environment build detailed tutorial Cocos2d-x 3.0RC, another way to create a project when referencing extension (including publishing to the Android platform) encounters problems with Android in the connection to ADB are down, problem and resolution "turn from" http/ Www.cocoachina.com/cocos/20140529/8596.html

Cocos2d-x 3.x full Platform Novice development configuration tutorial

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.