【发布时间】:2021-07-14 05:36:08
【问题描述】:
我在我的 gradle 文件中定义了基本 url,例如
buildTypes {
debug {
applicationIdSuffix ".debug"
minifyEnabled false
debuggable true
buildConfigField("String", "BASE_URL", "\"https://abc.tech/api/\"")
}
stag {
applicationIdSuffix ".stag"
minifyEnabled false
debuggable false
buildConfigField("String", "BASE_URL", "\"https://xyz.tech/api/\"")
}
}
我希望在我定义了深度链接的导航图中访问BASE_URL。即
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/navGraph"
app:startDestination="@id/fragmentX">
<fragment
android:id="@+id/fragment1"
android:name="com.xyz.abc.Fragmen1"
android:label="Fragmen1">
<argument
android:name="userId"
app:argType="string" />
<argument
android:name="code"
app:argType="string" />
<deepLink app:uri= "xyz.tech/api/confirm?userId={userId}&code={code}" />
</fragment>
</navigation>
【问题讨论】:
-
不可能。到目前为止,Android 导航组件不支持该功能来解析字符串
标签: android android-gradle-plugin android-xml android-navigation-graph