Cocos2dx How to reference third party so files (Android NDK)

Source: Internet
Author: User

The process of doing the project found that the reference to third-party library lib3rdsdk.so, when directly put lib3rdsdk.so into the Armeabi folder, will be deleted. Check on-line data are said to be incomplete, after the experiment, the simplest method is in the JNI under the ANDROID.MK riga below 3-7 lines can, to put the front, put the back may not do Oh, because the compilation path may be removed.

where prebuilt/$ (Target_arch_abi) in the prebuilt is JNI in the new prebuilt file, in fact, built does not matter, prebuilt inside there are 4 folders: Armeabi, ARMEABI-V7A, MIPS, x86, each folder has a different schema of the Lib3rdsdk.so Library, $ (Target_arch_abi) is automatically selected by the CPU architecture Armeabi, ARMEABI-V7A, MIPS, x86 these libraries in the schema, By default, only the Libtxpay.so libraries in the Armeabi are copied, for example, if you need to copy the libraries in armeabi-v7a, you need to add App_abi in application.mk: = Armeabi armeabi-v7a, The Armeabi armeabi-v7a Library will be copied at the same time

View Source
01 LOCAL_PATH := $(call my-dir)
02
03 include $(CLEAR_VARS)
04
05 LOCAL_MODULE    := 3rdsdk
06
07 LOCAL_SRC_FILES := prebuilt/$(TARGET_ARCH_ABI)/lib3rdsdk.so
08
09 include $(PREBUILT_SHARED_LIBRARY)
10
11 include $(CLEAR_VARS)
12
13 LOCAL_MODULE := game_shared
14
15 LOCAL_MODULE_FILENAME := libgame
16
17 #traverse all the directory and subdirectory
18
19 define walk
20
21   $(wildcard $(1)) $(foreach e, $(wildcard $(1)/*), $(call walk, $(e)))
22
23 endef
24
25 #traverse Classes Directory
26
27 ALLFILES = $(call walk, $(LOCAL_PATH)/../../Classes)
28
29 FILE_LIST := hellocpp/main.cpp
30
31 FILE_LIST += $(LOCAL_PATH)/../../Classes/helloworld.cpp
32
33 FILE_LIST += $(filter %.cpp, $(ALLFILES))
34
35 FILE_INCLUDES := $(shell find $(LOCAL_PATH)/../../Classes -type d)
36
37 #source file will be compiled
38
39 LOCAL_SRC_FILES := $(FILE_LIST:$(LOCAL_PATH)/%=%)                 
40
41 LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../../external/Box2D/ \
42
43   $(FILE_INCLUDES) \
44
45
46 LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static cocosdenshion_static cocos_extension_static box2d_static
47
48 include $(BUILD_SHARED_LIBRARY)
49
50 $(call import-module,CocosDenshion/android) \
51
52 $(call import-module,cocos2dx) \
53
54 $(call import-module,extensions) \
55
56 $(call import-module,external/Box2D)

Cocos2dx How to reference third party so files (Android NDK)

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.