如何在 AOSP 版本中添加 APK? [英] How do I add APKs in an AOSP build?

查看:51
本文介绍了如何在 AOSP 版本中添加 APK?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在我的 AOSP 版本中添加一些 3rd 方 APK.我应该将这些 APK 保存在哪个文件夹中,以便在构建代码和创建图像时将其安装在模拟器中?

I need to add some 3rd party APKs to my AOSP build. What folder should I keep these APKs so that when I build the code and the image is created, it is installed in the emulator?

看起来系统应用保存在 packages/app 文件夹中,所以我需要知道第三方 APK 保存在哪里.

It looks like the system apps are kept in the packages/app folder so I need to know where the third party APKs are kept.

推荐答案

将第三方 APK 添加到构建中绝对是可能的.

Adding third party APKs to the build is definitely possible.

也有源代码的APK和APP到同一个地方;package/app 文件夹.

Also APKs and APPs with source code go to the same place; the package/app folder.

向构建中添加新的 APK

在 AOSP 根目录中添加文件夹:

In the AOSP root add the folder:

/package/app/<;您的应用程序文件夹 >

然后在这个文件夹里面添加:

Then inside this folder add:

  • Android.mk
  • <代码>

android make 文件应该包含对您的 apk 的引用,将其添加到您的 Android.mk 中:

The android make file should have the reference to your apk, add this to your Android.mk:

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE_TAGS := optional

LOCAL_MODULE := < your app folder name >

LOCAL_CERTIFICATE := < desired key >

LOCAL_SRC_FILES := < app apk filename >

LOCAL_MODULE_CLASS := APPS

LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)

include $(BUILD_PREBUILT)

commons.mk 中创建一个条目(从 AOSP 8.1.0 开始,它被称为 core.mk,通常可以在 build/target/product) 为您的 apk 添加该行(检查所有其他人的位置)

Create an entry in the commons.mk (from AOSP 8.1.0 onwards it is called core.mk, and is usually found in build/target/product) for your apk add the line (check where all the others are)

PRODUCT_PACKAGES += < what you have defined in LOCAL_MODULE, it should be your app folder name >

编译 AOSP,您就会在系统上安装一个全新的应用.

Compile the AOSP and you have a brand new app installed on the system.

注意事项

  • 如果您的 APK 已经签名,请使用特殊值 PRESIGNED 作为 LOCAL_CERTIFICATE 的值
  • 如果您希望您的 APK 最终位于 /data/app/ 目录中,请在 行之前添加行 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA)包括 $(BUILD_PREBUILT)
  • If your APK is already signed, use the special value PRESIGNED as value for LOCAL_CERTIFICATE
  • If you want your APK to end up in the /data/app/ directory, add the line LOCAL_MODULE_PATH := $(TARGET_OUT_DATA) before the line include $(BUILD_PREBUILT)

这篇关于如何在 AOSP 版本中添加 APK?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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