问题描述
我已将应用程序链接添加到我的应用程序,并且已经将assetlinks.json文件上传到我的域。使用“应用程序链接支持”,单击“链接并验证”,可以得到以下信息:
到目前为止一切顺利。现在,当我在Logcat中安装应用程序并过滤IntentFilterIntentOp时,我正在将一个完全随机的主机添加到我的域列表中。主机名是string
,出现以下错误。
java.net.MalformedURLException:输入主机无效。
我在android清单中的活动如下:
<activity
android:name=".mainactivity.MainActivity"
android:launchMode="singleInstance">
<nav-graph android:value="@navigation/nav_host_main" />
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.broWSABLE" />
<data
android:scheme="https"
android:host="my-url" />
</intent-filter>
</activity>
我的问题是域string
来自哪里?
IntentFilterIntentOp的logcat过滤器如下所示:
Verifying IntentFilter. verificationId:89 scheme:"https" hosts:"my-url string" package:"my-package". [CONTEXT service_id=244 ]
解决方法
我发现了问题所在。 我还试图在导航组件的深层链接中包含变量。
所以我在片段中的深层链接看起来像
<fragment
...
<deepLink
android:id="@+id/deepLink6"
app:uri="@string/deeplink_setpassword_verify_email" />
</fragment>
这是Android将其作为字符串的地方。所以我不得不在这里写实际的URL。