Build sample addon in android5.1.1

3644 ワード

I met error when try to build sample sdk addon after I downloaded android5.1.1:
make -j8 PRODUCT-sample_addon-sdk_addon

... make: * No rule to make target images/source.properties', needed byout/host/linux-x86/obj/SDK_ADDON/platform_library_intermediates/platform_library-eng.tonywu-linux-x86-img'. Stop. make: * Waiting for unfinished jobs....

When searching source code,found file build/core/tasks/sdk-addon.mk where source.properties is define,but $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SDK_ADDON_SYS_IMG_SOURCE_PROP) is not set,so guess we should define PRODUCT_SDK_ADDON_SYS_IMG_SOURCE_PROP
64# Files copied in the system-image directory
65files_to_copy += \
66	$(addon_dir_img):$(BUILT_SYSTEMIMAGE):images/$(TARGET_CPU_ABI)/system.img \
67	$(addon_dir_img):$(BUILT_USERDATAIMAGE_TARGET):images/$(TARGET_CPU_ABI)/userdata.img \
68	$(addon_dir_img):$(BUILT_RAMDISK_TARGET):images/$(TARGET_CPU_ABI)/ramdisk.img \
69	$(addon_dir_img):$(PRODUCT_OUT)/system/build.prop:images/$(TARGET_CPU_ABI)/build.prop \
70	$(addon_dir_img):$(target_notice_file_txt):images/$(TARGET_CPU_ABI)/NOTICE.txt \
71	$(addon_dir_img):$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SDK_ADDON_SYS_IMG_SOURCE_PROP):images/source.properties

Final Solution:
make 2 changes on top of AOSP code:
1.Create file source.properties under device/sample/sdk_addon
2.Add one line in sample_addon.mk:
`enter code here`PRODUCT_SDK_ADDON_SYS_IMG_SOURCE_PROP := $(LOCAL_PATH)/source.properties
It's so annoying to met such error as google should have fixes such issues!!