简体   繁体   English

带有Android Studio的Jni生成错误:找不到库'/system/lib/libhoudini.so'

[英]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

I found out the solution from this post . 我从这篇文章中找到了解决方案。 It's because genymotion emulator need ARM translation library. 这是因为genymotion仿真器需要ARM转换库。 You can download it from here . 您可以从这里下载。 Hope it would help someone. 希望它会帮助某人。

暂无
暂无

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

相关问题 (Android) 在 Asus Phone 上的 /system/lib/libhoudini.so 上的本机崩溃 - (Android) Native crash at /system/lib/libhoudini.so on Asus Phone 引起:java.lang.UnsatisfiedLinkError:无法加载库:load_library [1098]:未找到库'/system/lib/libhoudini.so' - Caused by: java.lang.UnsatisfiedLinkError: Cannot load library: load_library[1098]: Library '/system/lib/libhoudini.so' not found java.lang.UnsatisfiedLinkError:无法加载库:load_library [1098]:找不到库'/system/lib/libhoudini.so' - java.lang.UnsatisfiedLinkError: Cannot load library: load_library[1098]: Library '/system/lib/libhoudini.so' not found Android 4.2 ndk:库加载崩溃:load_library(linker.cpp:750)|| soinfo_link_image || libhoudini.so || OpenCV的 - Android 4.2 ndk: library loading crash: load_library(linker.cpp:750) || soinfo_link_image || libhoudini.so || opencv 上传dependencies.apk时出错:警告:链接器:libhoudini.so具有文本重定位 - Error while uploading dependencies.apk : WARNING: linker: libhoudini.so has text relocations 我如何修复libhoudini.so具有文本重定位 - How can i fix libhoudini.so has text relocations Android 仿真器卡在引导循环中 - 找不到库“/system/lib/libnetcmdiface.so” - Android emulator stuck in boot loop -library "/system/lib/libnetcmdiface.so" not found Android树内构建:将* .so库包含到apk中,而不是链接到/ system / lib / - Android in-tree build: include *.so library to apk instead of link to /system/lib/ Android Studio JNI构建错误与cmake - Android Studio JNI build Error with cmake Android新构建系统,实验性插件,JNI库模块 - Android New Build System, Experimental Plugin, JNI Library Module
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM