错误增加prebuilt APK共享库AOSP错误、prebuilt、AOSP、APK

2023-09-04 05:31:00 作者:白鹿原

我试图将prebuilt APK添加到我的Andr​​oid版本。该APK包含几个共享库(* .so文件)。它编译没有问题,但我仍然得到一个错误的应用表明该库无法找到。

I tried to add a prebuilt APK to my Android build. The APK contains several shared libraries (*.so files). It compiles without problem, but I still get an error from the app indicating that the libraries cannot be found.

为什么会这样?

下面是 android.mk code:

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := apkwithso
LOCAL_SRC_FILES := $(LOCAL_MODULE).apk
LOCAL_REQUIRED_MODULES := libx liby libz
LOCAL_MODULE_CLASS := APPS
LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
LOCAL_CERTIFICATE := PRESIGNED
include $(BUILD_PREBUILT)

libx中,Y,Z是我libx.so,liby.so和libz.so

libx, y, z are my libx.so, liby.so, and libz.so

我也试图从APK手动复制。所以到了lib目录下,但没有奏效。

I also tried to copy the .so manually from the APK to the out lib directories but it didn't work.

我编译了Android 4.1.2的Galaxy Nexus的金枪鱼。

I am compiling with Android 4.1.2 for Galaxy Nexus Maguro.

推荐答案

BUILD_ preBUILT 要求 prebuild.mk 脚本。这个脚本的描述是这样的:

BUILD_PREBUILT calls prebuild.mk script. The description of this script is the following:

复制是prebuilt文件标准规则

Standard rules for copying files that are prebuilt

它不会告诉该应用程序将被安装。因此,我认为这就是为什么你的应用程序无法找到库。

It does not tell that the application will be installed. So I think that is why your application cannot find the libraries.

的解决方案是从包中提取库和分别复制它们从应用程序。细节如何做到这一点,你可以在这里找到 。

The solution is to extract libraries from the package and copy them separately from the application. The details how to do this you can find here.