在Android裡要怎麼建立靜態static android library呢?
這裡提供基本的方法…
Step1. 新增一個函式庫目錄(e.g: NativeService) 並撰寫Android.mk
NativeService/Android.mk
1 |
include $(BUILD_STATIC_JAVA_LIBRARY) |
Step2. 複製產生出來的 class-full-debug.jar 檔案到需要用到的地方
Copy
out/target/common/obj/JAVA_LIBRARIES/libNativeService_intermediates/class-full-debug.jar
To
demoNativeService/libNativeService.jar
Step3. 進入要用到的地方,編輯Android.mk
demoNativeService/Android.mk
1 2 3 4 5 6 |
LOCAL_STATIC_JAVA_LIBRARIES := libNativeService include $(BUILD_PACKAGE) ################################################## #include $(CLEAR_VARS) LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := libNativeService:libNativeService.jar include $(BUILD_MULTI_PREBUILT) |