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) |
05 |
LOCAL_MODULE := 3rdsdk |
07 |
LOCAL_SRC_FILES := prebuilt/$(TARGET_ARCH_ABI)/lib3rdsdk.so |
09 |
include $(PREBUILT_SHARED_LIBRARY) |
13 |
LOCAL_MODULE := game_shared |
15 |
LOCAL_MODULE_FILENAME := libgame |
17 |
#traverse all the directory and subdirectory |
21 |
$(wildcard $(1)) $(foreach e, $(wildcard $(1)/*), $(call walk, $(e))) |
25 |
#traverse Classes Directory |
27 |
ALLFILES = $(call walk, $(LOCAL_PATH)/../../Classes) |
29 |
FILE_LIST := hellocpp/main.cpp |
31 |
FILE_LIST += $(LOCAL_PATH)/../../Classes/helloworld.cpp |
33 |
FILE_LIST += $(filter %.cpp, $(ALLFILES)) |
35 |
FILE_INCLUDES := $(shell find $(LOCAL_PATH)/../../Classes -type d) |
37 |
#source file will be compiled |
39 |
LOCAL_SRC_FILES := $(FILE_LIST:$(LOCAL_PATH)/%=%) |
41 |
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../../external/Box2D/ \ |
46 |
LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static cocosdenshion_static cocos_extension_static box2d_static |
48 |
include $(BUILD_SHARED_LIBRARY) |
50 |
$(call import-module,CocosDenshion/android) \ |
52 |
$(call import-module,cocos2dx) \ |
54 |
$(call import-module,extensions) \ |
56 |
$(call import-module,external/Box2D) |
Cocos2dx How to reference third party so files (Android NDK)