Android.mk 中 filter 和 filter-out 的用法

本文介绍如何使用filter函数来过滤变量VARIANTS中的特定字符串,包括使用filter和filter-out函数进行字符串过滤操作,并通过示例展示其应用。

filter

$(filter word1 word2,$(VARIANTS))

判断变量VARIANTS中是否包含word1和 word2,如果包含就把VARIANTS中包含的word1和word2之外的过滤掉

示例:

VARIANTS := mon tue wed thu fri sat sun

DAY := $(filter sat sun,$(VARIANTS))

$(info $(DAY))


输出结果为:

sat sun


filter-out

$(filter-out word1 word2,$(VARIANTS))

判断变量VARIANTS中是否包含word1和 word2,如果包含就把VARIANTS中包含的word1和word2过滤掉,其余的全部保留

示例:

VARIANTS := mon tue wed thu fri sat sun

DAY := $(filter-out sat sun,$(VARIANTS))

$(info $(DAY))


输出结果为:

mon tue wed thu fri 





mon tue wed thu fri 
安卓OEM开发,在frameworks/base/services 的Android.bp添加了androidx.window_window依赖后,编译报错如下: FAILED: out_system/target/common/obj/APPS/SprdDialer_intermediates/enforce_uses_libraries.status /bin/bash -c "(rm -f out_system/target/common/obj/APPS/SprdDialer_intermediates/enforce_uses_libraries.status ) && (build/soong/scripts/manifest_check.py --enforce-uses-libraries --enforce-uses-libraries-status out_system/target/common/obj/APPS/SprdDialer_intermediates/enforce_uses_libraries.status --aapt out_system/host/linux-x86/bin/aapt2 --uses-library com.unisoc.sdk.common --uses-library org.apache.http.legacy --dexpreopt-config out_system/target/product/ussi_arm64/obj/JAVA_LIBRARIES/com.unisoc.sdk.common_intermediates/dexpreopt.config out_system/target/common/obj/APPS/SprdDialer_intermediates/manifest/AndroidManifest.xml )" error: mismatch in the <uses-library> tags between the build system and the manifest: - required libraries in build system: [com.unisoc.sdk.common, org.apache.http.legacy] vs. in the manifest: [com.unisoc.sdk.common, org.apache.http.legacy] - optional libraries in build system: [] vs. in the manifest: [androidx.window.extensions, androidx.window.sidecar] - tags in the manifest (out_system/target/common/obj/APPS/SprdDialer_intermediates/manifest/AndroidManifest.xml): <uses-library android:name="com.unisoc.sdk.common" android:required="true"/> <uses-library android:name="org.apache.http.legacy" android:required="true"/> <uses-library android:name="androidx.window.extensions" android:required="false"/> <uses-library android:name="androidx.window.sidecar" android:required="false"/> note: the following options are available: - to temporarily disable the check on command line, rebuild with RELAX_USES_LIBRARY_CHECK=true (this will set compiler filter "verify" and disable AOT-compilation in dexpreopt) - to temporarily disable the check for the whole product, set PRODUCT_BROKEN_VERIFY_USES_LIBRARIES := true in the product makefiles - to fix the check, make build system properties coherent with the manifest - for details, see build/make/Changes.md and https://source.android.com/devices/tech/dalvik/art-class-loader-context 怎么解决
08-12
FAILED: out_system/target/common/obj/APPS/SprdDialer_intermediates/enforce_uses_libraries.status /bin/bash -c "(rm -f out_system/target/common/obj/APPS/SprdDialer_intermediates/enforce_uses_libraries.status ) && (build/soong/scripts/manifest_check.py --enforce-uses-libraries --enforce-uses-libraries-status out_system/target/common/obj/APPS/SprdDialer_intermediates/enforce_uses_libraries.status --aapt out_system/host/linux-x86/bin/aapt2 --uses-library com.unisoc.sdk.common --uses-library org.apache.http.legacy --dexpreopt-config out_system/target/product/ussi_arm64/obj/JAVA_LIBRARIES/com.unisoc.sdk.common_intermediates/dexpreopt.config out_system/target/common/obj/APPS/SprdDialer_intermediates/manifest/AndroidManifest.xml )" error: mismatch in the <uses-library> tags between the build system and the manifest: - required libraries in build system: [com.unisoc.sdk.common, org.apache.http.legacy] vs. in the manifest: [com.unisoc.sdk.common, org.apache.http.legacy] - optional libraries in build system: [] vs. in the manifest: [androidx.window.extensions, androidx.window.sidecar] - tags in the manifest (out_system/target/common/obj/APPS/SprdDialer_intermediates/manifest/AndroidManifest.xml): <uses-library android:name="com.unisoc.sdk.common" android:required="true"/> <uses-library android:name="org.apache.http.legacy" android:required="true"/> <uses-library android:name="androidx.window.extensions" android:required="false"/> <uses-library android:name="androidx.window.sidecar" android:required="false"/> note: the following options are available: - to temporarily disable the check on command line, rebuild with RELAX_USES_LIBRARY_CHECK=true (this will set compiler filter "verify" and disable AOT-compilation in dexpreopt) - to temporarily disable the check for the whole product, set PRODUCT_BROKEN_VERIFY_USES_LIBRARIES := true in the product makefiles - to fix the check, make build system properties coherent with the manifest - for details, see build/make/Changes.md and https://source.android.com/devices/tech/dalvik/art-class-loader-context
最新发布
08-12
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值