何时安装系统/应用中的APK? [英] When are the APKs in system/app being installed?

查看:58
本文介绍了何时安装系统/应用中的APK?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个自定义系统映像,并将另一个APK放入系统/应用程序中.这有点工作,我可以运行该应用程序,但是未加载本机库(loadLibrary()失败).当我在APK上调用 pm install 时,一切正常,并且本地库已加载.

I created a custom system image and put an additional APK into system/app. This kinda works, I can run the app, however native libraries are not getting loaded (loadLibrary() fails). When I call pm install on the APK, everything works fine and the native library loads.

我的结论是APK未正确安装.我会很高兴了解我所观察到的行为.这是应该的样子还是我错过了一些东西?软件包管理器将在什么时候在应用程序(或priv-app)中安装APK.是否在某种时候可以运行某种设备设置?

My conclusion is that the APK is not getting installed properly. I would appreciate any background on the behavior I observe. Is this the way it should be or am I missing something? At what time would the package manager install the APKs in app (or priv-app). Is there some sort of device setup that runs at some point?

推荐答案

在AOSP上预安装的应用程序并没有像复制过来"那样被安装.

Pre-installed apps on AOSP aren't so much installed as kind of 'copied over'.

要使预编译的库"也被复制",必须在Android.mk中指定它们.

In order to have the prebuilt libs also 'copied over' you have to specify them in your Android.mk.

您可以通过在Android.mk上指定 LOCAL_PREBUILT_JNI_LIBS 来做到这一点.

You do this by specifying LOCAL_PREBUILT_JNI_LIBS on your Android.mk.

这是一个例子:

LOCAL_PATH := $(call my-dir)

my_archs := arm x86 arm64
my_src_arch := $(call get-prebuilt-src-arch, $(my_archs))

include $(CLEAR_VARS)
LOCAL_MODULE := TestApp
LOCAL_MODULE_CLASS := APPS
LOCAL_MODULE_TAGS := optional
LOCAL_BUILT_MODULE_STEM := package.apk
LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
LOCAL_CERTIFICATE := PRESIGNED
LOCAL_SRC_FILES := TestApp.apk

LOCAL_PREBUILT_JNI_LIBS := \
  @lib/arm64-v8a/libnoise.so

LOCAL_MODULE_TARGET_ARCH := $(my_src_arch)

include $(BUILD_PREBUILT)  

有一个名为 genandroidmk 的有用工具,可以自动为您生成此Android.mk:
https://github.com/northbright/genandroidmk

There is a useful tool called genandroidmk which can generate this Android.mk for you automatically:
https://github.com/northbright/genandroidmk

这篇关于何时安装系统/应用中的APK?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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