Cocos2d-x 3.0 references to third-party libraries and Android Mk file when compiling apk

Source: Internet
Author: User

In Cocos2d-x 3.0, If you need to use Cocosstudio, Extensions extension libraries and so on, you need to add them manually.


Add the steps as follows: (for example, now I want to add Libextensions,libCocosstudio, Libgui)


1. Add additional items


Right-click the solution---> Add Existing Project---> Add: Project directory \cocos2d\extensions\proj.win32\libextensions, and then you'll find one more on the left. Ibextensions Extension Library

< Span style= "White-space:pre" > Right-click solution---> Add an existing Project---> Add: project directory \ Cocos2d\cocos \editor-upport\cocostudio\proj.win32\libcocosstudio and then you'll find one more libcocosstudio Extension library

Libgui similar ....


Like this when done


2. References to these items


Right-click your project---Properties---Common properties---framework and reference---Add a reference, and then add libextensions,libCocosstudio, which is probably like this when done


3. Add the Include directory, otherwise your include header file will prompt you not to find


Right----Project---configuration properties---c/C + +---General---Additional Include directories---edit---add

$ (Engineroot)

$ (engineroot) Cocos

$ (engineroot) Cocos\editor-support


Probably like this when it's done.



4. Introduction of header File use


#include "extensions/cocos-ext.h" #include "cocostudio/cocostudio.h"

Note that the wording, not include "cocos-ext.h", although this kind of writing Win32 can be compiled through, but compiled into Android apk will often find cocos-ext.h and so on error


5. Compile to Android apk need to add path configuration in Android Mk file, attach my Android Mk file notation

Local_path: = $ (call My-dir) include $ (clear_vars) Local_module: = Cocos2dcpp_sharedlocal_module_filename: = Libcocos2dcpplocal_src_files: = Hellocpp/main.cpp. /.. /classes/appdelegate.cpp. /.. /classes/clipingnodelayer.cpp. /.. /classes/mainscene.cpp. /.. /classes/menutab.cpplocal_c_includes: = $ (Local_path)/. /.. /classeslocal_whole_static_libraries: = cocos2dx_staticlocal_whole_static_libraries + = Cocosdenshion_staticLOCAL_  Whole_static_libraries + = box2d_staticlocal_whole_static_libraries + = cocos_extension_static # add Cocos_extension Static library Local_whole_static_libraries + = cocostudio_static# Add Cocostudio static library include $ (build_shared_library) $ (call IMPORT-MODULE,2D) $ (call Import-module,audio/android) $ (call import-module,box2d) $ (call import-module,extensions) # Import Extensions module $ (call Import-module,editor-support/cocostudio) # import Cocostudio module

6 finally compiled as APK

CMD-->cd F:\VsProjects\cocos3Test (Engineering root directory)

Then command:

Cocos Compile-p Android-j 4
Then brew a cup of hot tea, wait for the compilation success ~ ~


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.