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

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

问题描述

我需要在我的AOSP版本中添加一些第三方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:

<aosp root>/package/app/< yourappfolder >

然后在此文件夹中添加:

Then inside this folder add:

  • Android.mk
  • < yourapp.apk >
  • empty Android.mk
  • < yourapp.apk >

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/目录中,请在include $(BUILD_PREBUILT)行之前添加LOCAL_MODULE_PATH := $(TARGET_OUT_DATA)
  • 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天全站免登陆