Summary of porting cocos2d-x to android

Source: Internet
Author: User

Today, cocos2d-x (2.1.3) project is ported to the android platform. Because the system is restored, the environment variables are reconfigured.

1First, install Cygwin (version 2.819. A headache. It may have been installed several times (I have installed it before and saved the downloaded file ). An error is reported when the installation ends. "Package: libpango1.0 _ 0 exit code 1", I thought it was a problem with fewer files. I tried it several times. The problem persists. No way. Google found that someone in the Forum raised this question.


In general, when executing/etc/postinstall/, You need to copy the pango. modules file to/etc/pango, but no pango folder is found. Error.

Therefore, manually create this folder. Go back to the previous step of the Installation Wizard. Reselect next. All the way OK (it seems that it is unstall first and then install ).

Then configure

650) this. width = 650; "src =" "title =" 1.JPG" alt = "152.161754.jpg"/>

650) this. width = 650; "src =" "title =" 2.JPG" alt = "154022875.jpg"/>

It is required for porting.

2. *** Android NDK: Aborting. Stop.


Android NDK: ERROR:/cygdrive/e/cocos2d-x/code/cocos2d-2.1rc0-x-2.1.3/HelloTest1/proj. android /.. /.. /cocos2dx/platform/third_party/android/prebuilt/libjpeg/Android. mk: cocos_assist_static: LOCAL_SRC_FILES points to a missing file
Android NDK: Check that/cygdrive/e/cocos2d-x/code/cocos2d-2.1rc0-x-2.1.3/HelloTest1/proj. android /.. /.. /cocos2dx/platform/third_party/android/prebuilt/libjpeg/libs/armeabi/libjpeg. a exists or that its path is correct
Make: Go to the directory "/cygdrive/e/cocos2d-x/code/cocos2d-2.1rc0-x-2.1.3/HelloTest1/proj. android"
/Cygdrive/e/android-ndk-windows/android-ndk-r9/build/core/ 45: *** Android NDK: Aborting. Stop.
Make: Leave the directory "/cygdrive/e/cocos2d-x/code/cocos2d-2.1rc0-x-2.1.3/HelloTest1/proj. android"

650) this. width = 650; "src =" "title =" 3.JPG" alt = "154730587.jpg"/>

This is a small file. But I'm from the cocos2d-2.1rc0-x-2.1.3 under the official website. Then install the build-win32.bat. All went well. The third-party library files of each platform are missing in cocos2dx \ platform \ third_party. CocosDenshion \ third_party is also a small library file. I don't know why I didn't extract it. But these library files are in the compressed files of the cocos2d-2.1rc0-x-2.1.3. No matter. If you extract the package and overwrite it, there will be no problem.

3An error is reported when compiling the CCCommon. cpp file.

Compile ++ thumb: cocos2dx_static <= CCCommon. cpp
E:/cocos2d-x/code/cocos2d-2.1rc0-x-2.1.3/HelloTest1/proj. android /.. /.. /cocos2dx/platform/android/CCCommon. cpp: In function 'void cocos2d: CCLog (char const *,...) ':
E:/cocos2d-x/code/cocos2d-2.1rc0-x-2.1.3/HelloTest1/proj. android /.. /.. /cocos2dx/platform/android/CCCommon. cpp: 44: 72: error: format not a string literal and no format arguments [-Werror = format-security]
E:/cocos2d-x/code/cocos2d-2.1rc0-x-2.1.3/HelloTest1/proj. android /.. /.. /cocos2dx/platform/android/CCCommon. cpp: In function 'void cocos2d: CCLuaLog (char const *)':
E:/cocos2d-x/code/cocos2d-2.1rc0-x-2.1.3/HelloTest1/proj. android /.. /.. /cocos2dx/platform/android/CCCommon. cpp: 54: 77: error: format not a string literal and no format arguments [-Werror = format-security]
Cc1plus.exe: some warnings being treated as errors

/Cygdrive/e/android-ndk-windows/android-ndk-r9/build/core/ 348: recipe for target 'obj/local/armeabi/objs/cocos2dx_static/platform/android/CCCommon. o 'failed'
Make: *** [obj/local/armeabi/objs/cocos2dx_static/platform/android/CCCommon. o] Error 1
Make: Leave the directory "/cygdrive/e/cocos2d-x/code/cocos2d-2.1rc0-x-2.1.3/HelloTest1/proj. android"

This problem also occurs when google goes to a foreign forum.

Because my ndk is r9, someone suggested to switch back to r8. I didn't try it. Finally, someone found this solution.

Modify the proj. android \ jni \ Application. mk file of your project, and add

APP_CPPFLAGS + =-Wno-error = format-security.

This article is from the goodlg blog, please be sure to keep this source

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: 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.