Add prebuilt apk to AOSP build

Phil picture Phil · Nov 10, 2015 · Viewed 10.8k times · Source

I tried to include a prebuilt google apk (with no .so file) to my marshmallow AOSP build based on the information found in this link as follows:

  1. In my vendor/manufacturer/device/proprietary/system/app, I created a folder named 'Testapk'.

  2. I saved two files in this 'Testapk' folder, the apk ('Testapk.apk') and an Android.mk file which contains the following instructions:

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE_TAGS := optional

LOCAL_MODULE := Testapk

LOCAL_SRC_FILES := $(LOCAL_MODULE).apk

LOCAL_MODULE_CLASS := APPS

LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)

LOCAL_CERTIFICATE := PRESIGNED

include $(BUILD_PREBUILT)

  1. I added the following instruction in my vendor/manufacturer/device/vendor_device.mk :

PRODUCT_PACKAGES += \

Testapk

When making the AOSP build, I get the following error:

make: *** No rule to make target `/Testapk', needed by `out/target/product/mako/obj/APPS/Books_intermediates/Testapk.apk'.  Stop.

#### make failed to build some targets (01:00 (mm:ss)) ####

Answer

Phil picture Phil · Nov 14, 2015

The problem with my Android.mk file was that it had trailing spaces on each line. Everything worked fine after I deleted these trailing spaces.