Using Android.bp can't install APK to userdata partition while building Android-13 AOSP

1,302 views
Skip to first unread message

tonyya...@gmail.com

unread,
Jul 24, 2023, 6:40:23 PM7/24/23
to Android Building
Hi,

We're adding our own application codes in Android-13 AOSP code and plan to build and install APK files to the specified directory in userdata partition during building AOSP code. We create Android.bp and add the following statements to it.

    //built explicitly put it in the data partition
    local_module_path: {
        var: "TARGET_OUT_DATA",
        fixed: "/preinstall/app",
    },

But, the build system is throwing out errors and can't install APK files under data/preinstall/app directory.

[ 25% 1/4] regenerate globs shard 250 of 1024
[ 50% 2/4] regenerate globs shard 565 of 1024
[ 75% 3/4] regenerate globs shard 581 of 1024
[100% 4/4] analyzing Android.bp files and generating ninja file at out/soong/build.ninja
FAILED: out/soong/build.ninja
cd "$(dirname "out/host/linux-x86/bin/soong_build")" && BUILDER="$PWD/$(basename "out/host/linux-x86/bin/soong_build")" && cd / &&  "$BUILDER"     --top "$TOP"     --soong_out "out/soong"     --out "out"     -o out/soong/build.ninja --globListDir build --globFile out/soong/globs-build.ninja -t -l out/.module_paths/Android.bp.list --available_env out/soong/soong.environment.available --used_env out/soong/soong.environment.used.build Android.bp
Clang SA is not enabled
error: vendor/bsp/proprietary/hlos/apps/SDK_Demo/app/src/main/Android.bp:27:22: unrecognized property "local_module_path"
ninja: build stopped: subcommand failed.
13:33:54 soong bootstrap failed with: exit status 1

And we tried Android.mk and add the following statements. It's able to build and install APK files to /data/preinstall/app directory.

# and when built explicitly put it in the data partition
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA)/preinstall/app

We're wondering how to use Android.bp to build and install APK file to the data/preinstall/app directory. We're looking forward to your suggestions to help us figure out this error.

Al Sutton

unread,
Jul 25, 2023, 11:39:06 AM7/25/23
to android-...@googlegroups.com, Android Building
You shouldn't install prebuilt apps into the data partition. Use the vendor partition instead.

--
--
You received this message because you are subscribed to the "Android Building" mailing list.
To post to this group, send email to android-...@googlegroups.com
To unsubscribe from this group, send email to
For more options, visit this group at

---
You received this message because you are subscribed to the Google Groups "Android Building" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-buildi...@googlegroups.com.

tonyya...@gmail.com

unread,
Aug 7, 2023, 2:23:44 PM8/7/23
to Android Building
Hi,

I'm sorry for not getting back to you sooner. To avoid confusion, my intention is to copy APK files and configuration files to the specified directory in the data image when building AOSP. And the APK files will be manually installed on the production line after the image is flashed to the devices, and then they will be removed after a factory reset.

However I got a building error when I declared the local_module_path as "TARGET_OUT_DATA" in Android.bp. It seems that soong can't resolve "TARGET_OUT_DATA" property.

Regards, Tony

chris simmonds

unread,
Aug 15, 2023, 11:42:34 AM8/15/23
to Android Building
Hi Tony,

As Al Sutton says, you can't install artifacts to /data using Android.bp. If you really want to do that, continue using Android.mk. However, the more usual way of provisioning preinstalled apps is install them into /product (or /vendor, but product is better IMO), and Android.bp can do that

Cheers,
Chris
Reply all
Reply to author
Forward
0 new messages