Reputation: 161
I am looking to add a prebuilt APK to AOSP build using the emulator. I successfully installed an APK into system/app directory by doing the related questions.
But I want to add an APK into data/app directory.
My development environments are followings:
- Ubuntu 16.04 LTS
- AOSP: android 6.0.1_r77
- AOSP emulator
I tried the following steps by the several related questions.
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
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA)
include $(BUILD_PREBUILT)
PRODUCT_PACKAGES += \ <name of APK>
The above Android.mk file didn't even install the APK into system/app.
And I also tried the followings. The following make files installed the APK into system/app.
...
LOCAL_MODULE_TAGS := tests
...
...
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
...
...
LOCAL_MODULE_PATH := $(TARGET_OUT)/data/app
...
I expect to install the APK into /data/app folder.
Upvotes: 2
Views: 2299
Reputation: 4746
There might be a better way, but the way I handled was by including the .apk in a system directory ( not installing it, just use PRODUCT_COPY_FILES ).
Add in your device.mk
code like this to copy the file:
PRODUCT_COPY_FILES += \
vendor/XXXXX/common/apps/MYApplication/MYApplication.apk:system/app/MYApplication.nm
Then modify Provision app ( which runs on first device boot ) to install that APK. The installation is done via PackageManager API. Check this answer, or similar.
Upvotes: 2