如何包括prebuilt的APK与Eclipse共享库 [英] how to include prebuilt shared libraries in apk with eclipse

查看:122
本文介绍了如何包括prebuilt的APK与Eclipse共享库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个共享库libfoo.so和需要使用它在我的Andr​​oid应用程序。

I have a shared library libfoo.so and need to use it in my android app.

我的第一次尝试是在Android.mk:

My first try was to have in Android.mk:

include $(CLEAR_VARS)
LOCAL_MODULE := test
LOCAL_SRC_FILES := test.cpp
LOCAL_LDLIBS := -L$(PATH_TO_FOO) -lfoo
include $(BUILD_SHARED_LIBRARY)

在我的活动,我有:

statis
{
    System.loadLibrary("foo");
}

这建立正确的,但我注意到,创建APK犯规包括libfoo.so(我也看到它是不会被复制到库/ armeabi)。我想这个原因我的UnsatisfiedLinkError执行我的应用程序的时候。

This builds correctly, however I noticed that created apk doesnt include libfoo.so (also I see it is not copied to libs/armeabi). I guess for that reason I have UnsatisfiedLinkError when executing my app.

我的,我需要添加$(preBUILD_SHARED_LIBRARY)一些其他职位看见,所以我以下内容添加到我的Andr​​oid.mk:

I saw in some other posts that I need to add $(PREBUILD_SHARED_LIBRARY), so I add the following to my Android.mk:

include $(CLEAR_VARS)
LOCAL_MODULE:= foo
LOCAL_SRC_FILES := $(FOO_PATH)/libfoo.so
include $(PREBUILD_SHARED_LIBRARY)

但现在我收到生成错误:

But now I am getting the build error:

foo: LOCAL_SRC_FILES points to a missing file.

我相信这条道路是正确的。需要注意的是libfoo.so是其一端origionally的版本号,但我不得不将其删除(只留下。所以),因为NDK建造抱怨。

I am sure that the path is correct. Note that the libfoo.so was having origionally the version number at the end, though I had to remove it (and leave only .so) since ndk-build complained.

我是什么做错了吗?

推荐答案

在包括似乎拼错:

include $(PREBUILD_SHARED_LIBRARY)

include $(PREBUILT_SHARED_LIBRARY)

这篇关于如何包括prebuilt的APK与Eclipse共享库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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