Eclipse接入第三方動態庫.so方案
在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編譯自動生成結果:
注意:eclipse接入動態連結庫流程, 選擇對應的ANDROID架構編譯好的.so檔案放入prebuilt目錄下, 修改android.mk檔案, 啟用Application.mk檔案中的
APP_ABI指定NDK編譯架構, 進行NDK編譯生成到libs對應資料夾中,在進行JAVA環境的配置和呼叫即可。
相關文章
- Android native層動態載入so庫Android
- C編譯: 動態連線庫 (.so檔案)編譯
- lua——alien庫實現lua呼叫C動態連結庫(dll、so)
- C語言動態庫libxxx.so的幾種使用方法C語言
- App極限瘦身: 動態下發soAPP
- windows和linux gcc生成動態連結庫DLL和SO並用python呼叫WindowsLinuxGCPython
- Android so庫防客戶端破解的解決方案Android客戶端
- eclipse 手動新增jar包到maven庫EclipseJARMaven
- 第三方平臺接入
- 靜態庫與動態庫
- Go構建遇到cgo動態庫時解決方案Go
- ios靜態庫和動態庫iOS
- DLL動態庫動態載入
- cmake:生成靜態庫和動態庫
- Linux共享庫、靜態庫、動態庫詳解Linux
- 動態庫使用
- Linux動態庫Linux
- 動靜態庫
- 鴻蒙手機版JNI實戰(JNI開發、SO庫生成、SO庫使用)鴻蒙
- 一種針對第三方線上地圖的動態勻色方案淺析地圖
- linux下的靜態庫與動態庫Linux
- 談談接入各種第三方推送平臺的技術方案和坑點
- 優秀第三方庫-動畫動畫
- 本地動態mock方案探索Mock
- Flutter 動態化方案探索Flutter
- C++動態庫封裝C#庫,驗證動態庫環境C++封裝C#
- linux 動態庫 靜態庫 函式覆蓋Linux函式
- android下java的靜態庫和動態庫AndroidJava
- iOS動態庫和靜態庫的運用iOS
- 動態連結庫與靜態連結庫
- [Linux]動靜態庫Linux
- Apk_動態除錯方案APK除錯
- DiscuzQ動態頁面SEO方案
- 一、靜態庫和動態庫,Makefile專案管理專案管理
- 簡述Linux下的靜態庫和動態庫Linux
- FFmpeg編譯Android使用的so庫編譯Android
- 筆記: 判斷lib庫是動態庫還是靜態庫筆記
- 編譯lua動態庫編譯
- iOS動態庫的使用iOS