[英]Jni build with Android studio error: Library '/system/lib/libhoudini.so' not found
Because some reason, I have to generate some text from C. So, I wrote some C method for that purpose. 由于某种原因,我必须从C生成一些文本。因此,我为此目的编写了一些C方法。 I build the Jni with Android studio, and it seem work fine with my 5.1.0 Genymotion emulator. 我使用Android Studio构建Jni,并且在我的5.1.0 Genymotion模拟器中似乎可以正常工作。 But when I run the build on 4.1.1 emulator, I got this issue : 但是当我在4.1.1模拟器上运行构建时,出现了这个问题:
Caused by: java.lang.UnsatisfiedLinkError: Cannot load library: load_library[1098]: Library '/system/lib/libhoudini.so' not found
at java.lang.Runtime.loadLibrary(Runtime.java:370)
at java.lang.System.loadLibrary(System.java:535)
After researching. 经过研究。 Maybe the problem is from building jni issue, that I haven't build the *.so file for x86. 也许问题出在构建jni问题,我还没有为x86构建* .so文件。 But when I decompile the apk, it seem that the *.so file already in "x86" folder. 但是,当我反编译apk时,*。so文件似乎已经在“ x86”文件夹中。
Here is the android.mk file that I get from app's build folder : 这是我从应用程序的build文件夹中获得的android.mk文件:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := ofx
LOCAL_LDFLAGS := -Wl,--build-id
LOCAL_SRC_FILES := \
xxx.../app/src/main/jni/key/Base64Util.c \
xxx.../app/src/main/jni/key/hidingutil.c \
LOCAL_C_INCLUDES += xxx.../app/src/main/jni
LOCAL_C_INCLUDES += xxx.../app/src/Beneficiary/jni
LOCAL_C_INCLUDES += xxx.../app/src/debug/jni
LOCAL_C_INCLUDES += xxx.../app/src/BeneficiaryDebug/jni
include $(BUILD_SHARED_LIBRARY)
Please help me make sure that the build will be fine to all devices, It will be very appreciated. 请帮助我确保该版本适用于所有设备,将不胜感激。 I don't have many devices to take test on. 我没有很多设备可以接受测试。 Thanks. 谢谢。
In your Android.mk file I don't see that you any prebuilt libs set as resources. 在您的Android.mk文件中,我看不到您将任何预构建的库设置为资源。 This could help in the inclusion. 这可能有助于纳入。
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := module_name
LOCAL_SRC_FILES := $(LOCAL_PATH)/prebuilt_lib_name.so
include $(PREBUILT_SHARED_LIBRARY)
Here is a Bash Script to help, add your ABI platforms in the APP_ABI area and change filepaths as necessary. 这是一个Bash脚本,可以帮助您,在APP_ABI区域中添加您的ABI平台,并根据需要更改文件路径。 No need to keep recompiling the whole thing altogether, but this will automate your native *.so builds and you can use gradle to do the rest: 无需完全重新编译整个过程,但这将使您的本机* .so构建自动化,您可以使用gradle完成其余工作:
ndk-build APP_ABI=armeabi-v7a NDK_LOG=true
if [ $? = 0 ]; then
rm -rf build/native-libs/
cd libs
for i in *
#rm -v */libofx.so
for arch in *
do
builddir=../build/native-libs/$arch
mkdir -p $builddir
cp -v $arch/*.so $builddir
done
fi
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.