将带有共享库的预构建 apk 添加到 AOSP 时出错 [英] Error adding prebuilt apk with shared libraries to AOSP

查看:28
本文介绍了将带有共享库的预构建 apk 添加到 AOSP 时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试将预构建的 APK 添加到我的 Android 版本中.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代码:

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

我还尝试将 .so 手动从 APK 复制到 out lib 目录,但没有成功.

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

我正在为 Galaxy Nexus Maguro 编译 Android 4.1.2.

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:

复制预构建文件的标准规则

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.

这篇关于将带有共享库的预构建 apk 添加到 AOSP 时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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