在Android.mk中加入如下代码
####### third so begin
include $(CLEAR_VARS)
LOCAL_MODULE:= agora-rtc
LOCAL_SRC_FILES :=../prebuilt/$(TARGET_ARCH_ABI)/libagora-rtc-sdk-jni.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE:= agoraSdkCWrwper
LOCAL_SRC_FILES := ../prebuilt/$(TARGET_ARCH_ABI)/libagoraSdkCWrapper.so
include $(PREBUILT_SHARED_LIBRARY)
####### third so end
### 定义头文件目录
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes \
$(LOCAL_PATH)/../../Classes/sdk/Agora \
$(LOCAL_PATH)/../../Classes/sdk/Agora/include
### 引用第三方模块
LOCAL_SHARED_LIBRARIES := agora-rtc agoraSdkCWrapper
include $(CLEAR_VARS) 清理变量信息
include $(PREBUILT_SHARED_LIBRARY) 预编译第三方库
LOCAL_PATH := $(call my-dir)
####### third so begin
include $(CLEAR_VARS) // 清理变量
LOCAL_MODULE:= agora-rtc // prebuilt中的.so库
LOCAL_SRC_FILES :=../prebuilt/$(TARGET_ARCH_ABI)/libagora-rtc-sdk-jni.so //完整路径
include $(PREBUILT_SHARED_LIBRARY) // ndk编译导入共享库
include $(CLEAR_VARS)
LOCAL_MODULE:= agoraSdkCWrapper
LOCAL_SRC_FILES := ../prebuilt/$(TARGET_ARCH_ABI)/libagoraSdkCWrapper.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE:= jcore116
LOCAL_SRC_FILES := ../prebuilt/$(TARGET_ARCH_ABI)/libjcore116.so
include $(PREBUILT_SHARED_LIBRARY)
####### third so end
include $(CLEAR_VARS)
LOCAL_MODULE := cocos2djs_shared
LOCAL_MODULE_FILENAME := libcocos2djs
ifeq ($(USE_ARM_MODE),1)
LOCAL_ARM_MODE := arm
endif
LOCAL_SRC_FILES := hellojavascript/main.cpp \
../../Classes/AppDelegate.cpp \
../../Classes/sdk/wx/Android/JniManager.cpp \
../../Classes/sdk/wx/Android/JSBindingAndroidWXManager.cpp \
../../Classes/sdk/wx/Android/JSBindingAndroidRecorderManager.cpp \
../../Classes/jsb/Android/AndroidNativeHttpClient.cpp \
../../Classes/jsb/Android/JSBindingAndroidNativeHttpClient.cpp \
../../Classes/sdk/Agora/AgoraManager.cpp \
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes \
$(LOCAL_PATH)/../../Classes/sdk/Agora \
$(LOCAL_PATH)/../../Classes/sdk/Agora/include
LOCAL_STATIC_LIBRARIES := cocos2d_js_static
LOCAL_SHARED_LIBRARIES := agora-rtc agoraSdkCWrapper jcore116
LOCAL_EXPORT_CFLAGS := -DCOCOS2D_DEBUG=2 -DCOCOS2D_JAVASCRIPT
include $(BUILD_SHARED_LIBRARY)
$(call import-module, scripting/js-bindings/proj.android)
Application.mk (编译架构 armeabi-v7a / armeabi-v8a / x86 通用架构: armeabi)
APP_STL := gnustl_static
# Uncomment this line to compile to armeabi-v7a, your application will run faster but support less devices
APP_ABI := armeabi-v7a x86 // ABI使用的编译架构
APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -std=c++11 -fsigned-char
APP_LDFLAGS := -latomic
USE_ARM_MODE := 1
ifeq ($(NDK_DEBUG),1)
APP_CPPFLAGS += -DCOCOS2D_DEBUG=1
APP_OPTIM := debug
else
APP_CPPFLAGS += -DNDEBUG
APP_OPTIM := release
endif
NDK编译自动生成结果:
APP_ABI指定NDK编译架构, 进行NDK编译生成到libs对应文件夹中,在进行JAVA环境的配置和调用即可。