android manifestPlaceholders - 如何使用布尔值

android manifestPlaceholders - how to use a boolean

我创建的清单占位符如下所示:

manifestPlaceholders = [appDrawerName: "Staging",canExport:"true"]

我正在尝试使用它在 activity 上设置以下导出的 属性:

<activity android:name=".UI.product.ProductDetailsHostActivity"
           android:theme="@style/NoActionBarTheme"
           android:exported="${canExport}"/>

但是我收到以下错误:

关于如何解决这个问题的任何想法?我尝试使用不带引号的 canExport:true 但结果相同。

顺便说一句,第一个占位符工作正常。

您必须提供一个布尔值而不是 manifestPlaceholders 数组中的字符串。

改变这个

manifestPlaceholders = [appDrawerName: "Staging",canExport:"true"]

manifestPlaceholders = [appDrawerName: "Staging",canExport:true]

注意布尔值 true 而不是字符串 "true"