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環境的配置和呼叫即可。
相關文章
- linuxjna呼叫so動態庫Linux
- 動態庫so打包到android apkAndroidAPK
- linux 動態裝載動態庫 ldd,ldconfig,ld.so.conf, ld.so.cacheLinux
- Android native層動態載入so庫Android
- C編譯: 動態連線庫 (.so檔案)編譯
- lua——alien庫實現lua呼叫C動態連結庫(dll、so)
- Android 開發中如何動態載入 so 庫檔案Android
- App極限瘦身: 動態下發soAPP
- Framework載入現有第三方JAR包或SO庫FrameworkJAR
- 在Eclipse 下整合ndk 自動編譯生成so檔案Eclipse編譯
- Linux 依賴動態庫 / 靜態庫的動態態庫 / 靜態庫Linux
- 第三方平臺接入
- iOS靜態庫SDK製作(包含第三方靜態庫)iOS
- 黑科技:把第三方 iOS 應用轉成動態庫iOS
- 關於Android NDK中呼叫第三方的動態庫Android
- 靜態庫與動態庫
- Go構建遇到cgo動態庫時解決方案Go
- Android so庫防客戶端破解的解決方案Android客戶端
- C語言動態庫libxxx.so的幾種使用方法C語言
- ios靜態庫和動態庫iOS
- Linux下的靜態庫、動態庫和動態載入庫Linux
- DLL動態庫動態載入
- tensorflow整合到Android以及so庫和pb檔案的動態載入實踐Android
- 一種針對第三方線上地圖的動態勻色方案淺析地圖
- cmake:生成靜態庫和動態庫
- Flutter 動態化方案探索Flutter
- 本地動態mock方案探索Mock
- 談談接入各種第三方推送平臺的技術方案和坑點
- 動靜態庫
- 動態庫使用
- 動態庫和靜態庫的區別
- eclipse 匯入靜態類,自動程式碼提示靜態方法Eclipse
- Linux共享庫、靜態庫、動態庫詳解Linux
- DiscuzQ動態頁面SEO方案
- Apk_動態除錯方案APK除錯
- 騰訊 IVWEB 團隊:通過 ffi 在 Node.js 中呼叫動態連結庫 (.so/.dll 檔案)WebNode.js
- eclipse 手動新增jar包到maven庫EclipseJARMaven
- NDK 連結第三方靜態庫的方法