Android的NDK和.so.X扩展 [英] Android NDK and .so.X extensions

查看:204
本文介绍了Android的NDK和.so.X扩展的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图用Grantlee库在Android NDK应用。

I'm trying to use the Grantlee library in an Android NDK app.

我可以编译Grantlee就好了,我也得到 libGrantlee_Templates.so libGrantlee_Templates.so.5 ,和 libGrantlee_Templates.so.5.0.0

I can compile Grantlee just fine, and I get libGrantlee_Templates.so, libGrantlee_Templates.so.5, and libGrantlee_Templates.so.5.0.0.

这三者中,我只能安装在我的Andr​​oid.mk第一个:

Of these three, I can only install the first one in my Android.mk:

include $(CLEAR_VARS)
LOCAL_MODULE := libgrantlee
LOCAL_SRC_FILES := $(GRANTLEE_PATH)/lib/libGrantlee_Templates.so
include $(PREBUILT_SHARED_LIBRARY)

因为如果我试图安装其它两个的,然后我得到:

Because if I try to install either of the other two, then I get:

Android NDK: ERROR:Android.mk:grantlee: LOCAL_SRC_FILES should point to a file ending with ".so"
Android NDK: The following file is unsupported: libGrantlee_Templates.so.5

不过,像一个残酷的玩笑,我不能安装.so.5正是它看起来在运行时文件:

But then, like a cruel joke, the .so.5 that I can't install is exactly the file that it looks for at runtime:

E/AndroidRuntime(14439): java.lang.UnsatisfiedLinkError: dlopen failed: could not load library "libGrantlee_Templates.so.5"; caused by library "libGrantlee_Templates.so.5" not found

我该如何解决这个问题?

How do I solve this?

推荐答案

当你用NDK工具链的独立本地共享库,你必须改变它的make文件摆脱 .version 后缀。例如,见这是怎么做了的ffmpeg

When you build a native shared library with NDK standalone toolchain, you must change its make files to get rid of .version suffixes. See for example how this is done for ffmpeg.

这篇关于Android的NDK和.so.X扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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