使用 Eclipse 加载 Android 原生库

发布于 2024-11-09 06:14:01 字数 643 浏览 0 评论 0原文

我对 Android 开发相当陌生,我已经尝试了一段时间,但我就是不明白。我正在为 android 编写一个创建 gif 的应用程序,为此我正在使用 这个库。我将其编译为 .so 但现在我只是不明白如何实际加载它。我把 .so 放在 /libs/armeabi/ 中,但是当我加载它时,

    static {
        System.loadLibrary("gifflen");
    }    

它会抛出

   ERROR/AndroidRuntime(13565): Caused by: java.lang.UnsatisfiedLinkError: Couldn't load gifflen: findLibrary returned null

异常,我应该把它放在其他地方吗?或者这是因为我应该更改 Eclipse 中的某些设置? 我已经对 Java 构建路径中的本机库选项进行了修改,但这似乎不是我正在寻找的。 我还用谷歌搜索了一下,找到了一个答案,说选择“Android Tools->Add Native Support”,但我没有这个选项。

I'm fairly new to Android development and I've been trying for a while now but I just don't get it. I'm writing an app for android that creates gifs, and for that I'm using this library. I compiled it into an .so but now I just don't understand how to actually load it. I put the .so in /libs/armeabi/ but when I load it like

    static {
        System.loadLibrary("gifflen");
    }    

it throws

   ERROR/AndroidRuntime(13565): Caused by: java.lang.UnsatisfiedLinkError: Couldn't load gifflen: findLibrary returned null

Am I supposed to put it somewhere else? Or is this because of some setting in Eclipse I was supposed to change?
I've mucked about with the native library option in Java Build Path but that doesn't seem to be what I'm looking for.
I've also googled around a bit and found an answer that said to select select Android Tools->Add Native Support but I don't have that option.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

动听の歌 2024-11-16 06:14:01

你内置到了 .so 如何?使用NDK?如果是这样,那么创建的文件应该被称为 libgrifflen.so。是吗?

You built into into an .so how? Using the NDK? If so then the file that was created should have been called libgrifflen.so. Was it?

给我一枪 2024-11-16 06:14:01

实质上,您需要告诉系统这样的库存在以及它位于哪里。这是在 Eclipse 中完成的,方法是右键单击项目名称,然后选择“Android Tools”,然后选择“Add Native Support”。如果项目已经有本机支持,则不存在此选项 - 如果您是初学者,最好从头开始创建一个新项目。

Substantially, you need to tell the system that such library exists and where it is located. This is done inside Eclipse by right-clicking on the project name and then selecting "Android Tools" and then "Add Native Support". If the project already has Native Support, this option is not present - if you are a beginner it is better that you create a new project from scratch.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文