从另一个Android应用程序加载本地共享库 [英] Load native shared library from another Android application

查看:144
本文介绍了从另一个Android应用程序加载本地共享库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要分发的应用程序(的球员),它依赖于一个给定的ARM版和扩展(Tegra的,霓虹灯)建立了一个机库。此机库是相当大的,所以我不能分发其在一个通用包中的所有版本。所以我决定分割应用程序到一个小小的通用.apk文件,专业化.apks - 没有任何活动的插件

I need to distribute an application (a player), which depends on a native library built for a given ARM version and extension (Tegra, Neon). This native library is quite large so I can’t distribute all its versions in one universal package. So I decided to split the application into one small universal .apk and more specialized .apks – plug-ins without any activities.

我如何可以访问一个专门的本地共享库的插件应用从主主机应用程序?是否可以简单地使用

How can I access a specialized native shared library in the plug-in app from the main host application? Is it possible to use simply

System.loadLibrary("path_to_library"); 

如果是这样,我怎么能得到的路径库?

If so, how can I get the path to that library?

如何的情况下解决这个问题是不可能的

How to solve this problem in case it is not possible?

推荐答案

的System.loadLibrary()需要一个库名并将其映射到一个莫名其妙的完整路径。

System.loadLibrary() takes a library name and maps it to a full path somehow.

富=> libfoo.so

foo => libfoo.so

系统正常检查A​​PK本身,然后通常 /系统/ lib中/

The system normally checks the apk itself and then usually /system/lib/

如果你有一个完整的路径,使用 System.load()

If you have a full path, use System.load()

在任何情况下,这将是一个麻烦来管理你的lib的位置,除非它无论是在APK或者所有的系统库。

In any case it will be a hassle to manage the location of your lib unless it's either in the apk or with all the system libs.

我刚刚打包的APK特定的库。

I'd just pack the specific lib with the apk.

这篇关于从另一个Android应用程序加载本地共享库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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