1

编辑:这是清单合并中的一个错误(缺少功能?)。它适用于 Android Studio 3.5 Canary 5 及更高版本。所以想要做的是为<deepLink />每个 uri 添加一个。在我的情况下是

<deepLink
    android:id="@+id/deepLink"
    app:uri="https://www.example.com/foo?cn={cardNumber}&amp;bd={birthDate}"/>

<deepLink
    android:id="@+id/deepLink2"
    app:uri="https://www.example.com/foo?cn={cardNumber}"/>

我在表格中有一个深层链接"https://www.example.com/foo?cn=L349DA&bd=1982-03-12"

我在我的导航图中解析它

<deepLink
    android:id="@+id/deepLink"
    app:uri="https://www.example.com/foo?cn={cardNumber}&amp;bd={birthDate}"/>

这一切都很好。但是我的参数bd是可选的,所以我不能保证它会包含在 url 中。我们如何处理这种情况?

我试过*在参数上使用通配符,但没有成功。而且我尝试添加两个<deepLink .../>元素,但这会产生Manifest merger failed: Multiple destinations...错误。

提前致谢!

4

1 回答 1

1

在“ androidx.navigation:navigation-*:2.2.0-alpha02

2019 年 9 月 5 日

带有查询参数的深层链接现在支持重新排序的查询参数;匹配深层链接时,具有默认值或可为空的参数现在是可选的。( b/133273839 )

Android 开发者 Jetpack AndroidX 导航

于 2019-09-17T15:42:55.117 回答