今天陽曆生日,明天光棍節。繼續光著吧。
前幾天,編譯Android程式時,出現了類似下面的一個錯誤。
build/core/base_rules.mk:74: *** Module name: xxxtest
build/core/base_rules.mk:75: *** Makefile location: packages/xxx/xxxtest
build/core/base_rules.mk:76: *
build/core/base_rules.mk:77: * Each module must use a LOCAL_MODULE_TAGS in its
build/core/base_rules.mk:78: * Android.mk. Possible tags declared by a module:
build/core/base_rules.mk:79: *
build/core/base_rules.mk:80: * optional, debug, eng, tests, samples
build/core/base_rules.mk:81: *
build/core/base_rules.mk:82: * If the module is expected to be in all builds
build/core/base_rules.mk:83: * of a product, then it should use the
build/core/base_rules.mk:84: * "optional" tag:
build/core/base_rules.mk:85: *
build/core/base_rules.mk:86: * Add "LOCAL_MODULE_TAGS := optional" in the
build/core/base_rules.mk:87: * Android.mk for the affected module, and add
build/core/base_rules.mk:88: * the LOCAL_MODULE value for that component
build/core/base_rules.mk:89: * into the PRODUCT_PACKAGES section of product
build/core/base_rules.mk:90: * makefile(s) where it's necessary, if
build/core/base_rules.mk:91: * appropriate.
build/core/base_rules.mk:92: *
build/core/base_rules.mk:93: * If the component should be in EVERY build of ALL
build/core/base_rules.mk:94: * products, then add its LOCAL_MODULE value to the
build/core/base_rules.mk:95: * PRODUCT_PACKAGES section of
build/core/base_rules.mk:96: * build/target/product/core.mk
build/core/base_rules.mk:97: *
build/core/base_rules.mk:98: *** user tag detected on new module - user tags are only supported on legacy modules. Stop.
看這段解釋,也上網搜答案,都說要把寫上LOCAL_MODULE_TAGS := optional這麼一行。但是明明我寫了啊?看來不是這個問題。
後來才發現,原來是我Android.mk裡,變數賦值的順序的問題。
本來在LOCAL_MODULE := xxxtest和include $(BUILD_EXECUTABLE)之間,我還給了好幾個變數賦了值,有一個還是前面賦了一段,在這兩者之間又賦了一段。我試著將LOCAL_MODULE
:= test_exe和include $(BUILD_EXECUTABLE)放到最後。問題突然就解決了。
因為太忙,也沒去看看到底是什麼問題。就去忙別的了。
如果誰遇到這問題,看是不是這個問題,咱們再探討。