Is it possible to add a prebuilt APK to an AOSP build as an user app?

Viewed 6485

I am looking to add a prebuilt APK to my AOSP build. I can already do this by doing the following:

  1. Add the APK to the $root_of_my_source_tree/packages/apps folder.
  2. Create an Android.mk file. The file has the following contents:

    LOCAL_PATH := $(call my-dir)
    
    include $(CLEAR_VARS)
    
    LOCAL_MODULE_TAGS := optional
    
    LOCAL_MODULE := <name of APK>
    
    LOCAL_SRC_FILES := <Name of APK>.apk
    
    LOCAL_MODULE_CLASS := APPS
    
    LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
    
    LOCAL_CERTIFICATE := platform
    
    include $(BUILD_PREBUILT)
    
  3. Add:

    PRODUCT_PACKAGES += \ <name of APK>
    

    To a make file that gets picked up by the AOSP build system.

This adds the APK to the /system/app folder which is read-only so the user will not be able to update the APK. I would like the APK to be placed in the /data/app folder so the user can actually update the prebuilt APK.

I have tried the suggestions in this question and they did not work. I tried the suggestion in this question and while it did output the APK to the /data/app folder of the finished build, once I flashed the image onto my device, the app was not there. The second answer in that question does provide a possible explanation for this but no other suggestions.

Ultimately, I need an APK preloaded in my build that can be updated so if this doesn't work or is a bad approach, I am open to suggestions.

2 Answers
Related