如何在Android AOSP 13中为模拟器构建/system/目录的系统应用?

huangapple go评论72阅读模式
英文:

How to build a system app in Android AOSP 13 for /system/ directory for emulator?

问题

I want to build a sample system app which lives in the /system/app directory.

我想要构建一个位于 /system/app 目录下的示例系统应用。

I am building AOSP Emulator using the goldfish device for the target product sdk_phone64_x86_64.

我正在使用 goldfish 设备构建目标产品 sdk_phone64_x86_64 的 AOSP 模拟器。

The standard process as per my knowledge was to get the application code to compile in AOSP environment first, using the Android.bp mechanism and then use PRODUCT_PACKAGES in a device.mk type file for the required target.

根据我的了解,标准流程是首先在 AOSP 环境中使用 Android.bp 机制编译应用代码,然后在设备.mk 类型的文件中为所需的目标使用 PRODUCT_PACKAGES

But this will cause build errors for artifact path requirement.

但这会导致构建错误,因为需要构建路径。

If I add the app name in 64bitonly/product/vendor.mk under device/generic/goldfish, and compile the systemimage using make, I get an error:

如果我在 device/generic/goldfish 下的 64bitonly/product/vendor.mk 中添加应用名称,并使用 make 编译系统映像,我会收到错误消息:

build/make/core/artifact_path_requirements.mk:30: warning: device/generic/goldfish/64bitonly/product/sdk_phone64_x86_64.mk produces files inside build/make/target/product/generic_system.mks artifact path requirement. Offending entries: system/app/SampleSystemApp/SampleSystemApp.apk In file included from build/make/core/main.mk:1352: build/make/core/artifact_path_requirements.mk:30: error: Build failed. 16:08:03 ckati failed with: exit status 1

build/make/core/artifact_path_requirements.mk:30: 警告:device/generic/goldfish/64bitonly/product/sdk_phone64_x86_64.mk 在构建路径中生成文件,构建路径要求。有问题的条目:system/app/SampleSystemApp/SampleSystemApp.apk 从 build/make/core/main.mk 中包含的文件:build/make/core/artifact_path_requirements.mk:30: 错误:构建失败。16:08:03 ckati 失败,退出状态为 1

Later I did try Enforcing Product Partition Interfaces via this commit, but the same situation. So what is correct way to build an app in AOSP Android 13 environment which goes in /system partition?

后来,我尝试通过 Enforcing Product Partition Interfaces 使用 这个 提交来实施,但情况依然相同。那么,在 AOSP Android 13 环境中构建位于 /system 分区中的应用的正确方法是什么?

Some examples include HTMLViewer, Keychain, etc.

一些示例包括 HTMLViewerKeychain 等。

However, I don't wish to modify build/make/target/product/handheld_system.mk

然而,我不想修改 build/make/target/product/handheld_system.mk

Is there a way to achieve this?

有办法实现这一目标吗?

英文:

I want to build a sample system app which lives in the /system/app directory.

I am building AOSP Emulator using the goldfish device for the target product sdk_phone64_x86_64.

The standard process as per my knowledge was to get the application code to compile in AOSP environment first, using the Android.bp mechanism and then use PRODUCT_PACKAGES in a device.mk type file for the required target.

But this will cause build errors for artifact path requirement.

If I add the app name in 64bitonly/product/vendor.mk under device/generic/goldfish, and compile the systemimage using make, I get an error:

build/make/core/artifact_path_requirements.mk:30: warning:  device/generic/goldfish/64bitonly/product/sdk_phone64_x86_64.mk produces files inside build/make/target/product/generic_system.mks artifact path requirement.
Offending entries:
system/app/SampleSystemApp/SampleSystemApp.apk
In file included from build/make/core/main.mk:1352:
build/make/core/artifact_path_requirements.mk:30: error: Build failed.
16:08:03 ckati failed with: exit status 1

Later I did try Enforcing Product Partition Interfaces via this commit, but the same situation. So what is correct way to build an app in AOSP Android 13 environment which goes in /system partition?

Some examples include HTMLViewer, Keychain, etc.

However, I don't wish to modify build/make/target/product/handheld_system.mk

Is there a way to achieve this?


Note: Adding the module name to PRODUCT_PACKAGES in vendor.mk works fine on Android 10 AOSP.

答案1

得分: 0

使用 /system_ext 而不是 /system。在我看来,捆绑系统应用程序的最佳方法是根据需要直接使用产品或 odm 分区。

英文:

So the actual solution is to utilise the flags

PRODUCT_ARTIFACT_PATH_REQUIREMENT_ALLOWED_LIST+= \
	system/app/SampleSystemApp/%

I added in my vendor.mk file and compiled the system image succesfully. However, Google suggests to use /system_ext instead. Overall, the best way IMO to bundle system apps is to directly use product or odm partitions as per requirement.

huangapple
  • 本文由 发表于 2023年4月11日 13:33:17
  • 转载请务必保留本文链接:https://go.coder-hub.com/75982657.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定