简体   繁体   English

Android:在NDK的jar文件中链接预构建的共享库(.so)

[英]Android : link prebuilt shared library (.so) within jar file in NDK

I've a static java library compiled as a jar file. 我有一个编译为jar文件的静态Java库。 This jar loads a .so library using System.loadLibrary. 此jar使用System.loadLibrary加载.so库。 Then another Android application project links statically the jar file. 然后,另一个Android应用程序项目静态链接jar文件。

Everything is compiled using an Android.mk file in the NDK...how can I make the shared native library being included and correctly loaded from my final application (and "seen" from the jar code)? 一切都使用NDK中的Android.mk文件进行编译...如何使共享的本机库包含在最终应用程序中并正确加载(以及从jar代码中“看到”)?

Ok I solved the problem by using these instructions in Android.mk: 好的,我通过使用Android.mk中的以下说明解决了问题:

$(shell cp $(wildcard $(LOCAL_PATH)/libs/armeabi/*.so) $(TARGET_OUT_INTERMEDIATE_LIBRARIES)) LOCAL_JNI_SHARED_LIBRARIES:= libMyLib $(shell cp $(通配符$(LOCAL_PATH)/ libs / armeabi / *。so)$(TARGET_OUT_INTERMEDIATE_LIBRARIES))LOCAL_JNI_SHARED_LIBRARIES:= libMyLib

just before 就在之前

include $(BUILD_PACKAGE) 包括$(BUILD_PACKAGE)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM