Android NDK java.lang.UnsatisfiedLinkError: findLibrary 返回 null [英] Android NDK java.lang.UnsatisfiedLinkError: findLibrary returned null

查看:29
本文介绍了Android NDK java.lang.UnsatisfiedLinkError: findLibrary 返回 null的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在您的 Android JNI 应用中出现上述错误?继续阅读...

Having the above error in your Android JNI app? Read on...

在前面,我会说我已经以自己的方式解决了这个问题,但是我觉得 Android 构建系统中的某些东西(可能与 Eclipse 相关)已经坏了,我希望可以为其他人节省数小时的痛苦.也许其他人已经遇到过这个问题,并且可以评论什么对他们有用.

Up front, I'll say that I've already solved this, in my own way, but I feel something in the Android build system (perhaps regarding Eclipse) is broke, and I hope to save someone else hours of pain. Perhaps others have come across this issue and can comment on what worked for them.

有一段时间,我有一个带有一些使用 NDK 开发的 JNI 代码的 Android 项目.然后,今天,我更改了 java 代码中的某些内容,然后噗,我无法再加载我的 JNI 库.它失败了,异常如下:

For a while, I've had an Android project with some JNI code that I developed using the NDK. Then, today, I changed something in the java code and then poof, I could no longer load my JNI library. It failed with an exception like:

E/AndroidRuntime(999): java.lang.UnsatisfiedLinkError: 无法加载 mylibrary: findLibrary 返回 null

E/AndroidRuntime( 999): java.lang.UnsatisfiedLinkError: Couldn't load mylibrary: findLibrary returned null

我用谷歌搜索并尝试了一切(重建、关闭和重新启动 Eclipse 等)

I googled and tried everything (rebuilding, close and relaunch Eclipse, etc, etc)

什么最终解决了我的问题?在尝试再次运行之前,我从设备上实际卸载了我的应用程序.而已.在那之后,它奏效了.什么对你有用?

What finally fixed my problem? I physically uninstalled my app from the device before trying another run. That's it. After that, it worked. What worked for you?

推荐答案

如果你有一个本地项目 LOCAL_MODULE "libXYZ",请确保将其加载为

If you have a native project with LOCAL_MODULE "libXYZ", make sure to load it as

System.loadLibrary("XYZ");

这篇关于Android NDK java.lang.UnsatisfiedLinkError: findLibrary 返回 null的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆