Cocos2d-x v2 V3 build LUA project, Android test

Source: Internet
Author: User

System Environment win8.1

All test items are generated under D:\game\cocos

Cocos2d-x Engine Catalog for d:\game\cocos2d-x-2.2.5 and d:\game\cocos2d-x-3.2

Android NDK Directory D:\Android\android-ndk-r9d


1. Build the project

Go to D:\game\cocos2d-x-2.2.5\tools\project-creator to execute the command line

Python luagamev2-package org.test-language Lua

The project is generated in D:\game\cocos2d-x-2.2.5\projects, where LuaGameV2 is copied to D:\game\cocos

2. Build Android Project

2.1 Select D:\game\cocos\LuaGameV2\ to import into eclipse. This project name is called Hellolua, and in eclipse you will see the Hellolua project, structured as follows

The arrows refer to the files that do not exist and need to be created by ourselves

2.2 There will be a missing cocos2dxactivity error first, here you can import the D:\game\cocos2d-x-2.2.5\cocos2dx\platform\android\java project to eclipse,

2.2.1 Here I renamed LOIBCOCOS2DX to Libcocos2dx-v2, I can add libcocos2dx-v2 directly to Hellolua's BuildPath project

2.2.2 will automatically generate the Libcocos2dx.jar package under the bin after import, of course, you can generate the jar package yourself, copy the package to LuaGameV2, and then join BuildPath

Either of these two options

2.3 Classes is a link resource from D:\game\cocos\LuaGameV2\Classes is primarily convenient for viewing CPP code in eclipse

2.4 Jni Generating so files

2.4.1 is compiled here using Android NDK r9d

The command line enters into the D:\game\cocos\LuaGameV2\ and executes


There will be an error ndk_import_path unspecified what?

This is mostly D:\game\cocos\LuaGameV2\\jni\ the module path is not configured to be added in

$ (call import-add-path,d:/game/cocos2d-x-2.2.5)

$ (call import-add-path,d:/game/cocos2d-x-2.2.5/cocos2dx/platform/third_party/android/prebuilt)

Continue with D:\Android\android-ndk-r9d\ndk-build compilation generates OBJ and Libs package contents at this time

2.5 Introduce the resource file into assets to copy the D:\game\cocos\LuaGameV2\Resources file to assets

3. Test Android

3.1 Note Add the inside COCOSDX item or Libcocos2dx.jar to the orderandexport when the output

Test success



Cocos2d-x v2 V3 build LUA project, Android test

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.