Android:意图过滤器验证失败

Android:意图过滤器验证失败,android,intentfilter,deep-linking,Android,Intentfilter,Deep Linking,我的目标是让Android自动打开我应用程序中以test.touchwonders.com开头的任何链接。我已将所需文件放在服务器上:https://test.touchwonders.com/.well-known/assetlinks.json 这是我舱单的相关部分: <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@str

我的目标是让Android自动打开我应用程序中以
test.touchwonders.com
开头的任何链接。我已将所需文件放在服务器上:
https://test.touchwonders.com/.well-known/assetlinks.json

这是我舱单的相关部分:

    <application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme"
    android:name="com.justbrands.highstreet.pmelegend.PmeApplication">
    <activity
        android:name="com.highstreet.core.activity.MainActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>


        <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="http" />
            <data android:scheme="https" />
            <data android:host="test.touchwonders.com" />
            <data android:host="www.test.touchwonders.com" />
        </intent-filter>

        <intent-filter>
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
            <data android:scheme="pme-legend"/>
        </intent-filter>

    </activity>
</application>

我的设备使用Charles代理,允许您查看请求。我看不到有人请求test.touchwonders.com。在安装之前,我使用了
adb shell pm clear com.android.statementservice
,它应该清除缓存并强制重新获取json

原来问题不在我的应用程序中,而是在网站服务器上的assetlinks.json文件中。在我的例子中,问题是服务器响应的MIME类型不是
application/json
,我真正的问题是我没有测试AssetLink文件的方法。同时,我发现了一个:

并使用测试url

https://digitalassetlinks.googleapis.com/v1/statements:list?
source.web.site=https://<domain1>:<port>&
relation=delegate_permission/common.handle_all_urls
https://digitalassetlinks.googleapis.com/v1/statements:list?
source.web.site=https://:&
关系=委托权限/common.handle\u所有URL

我遇到了相同的问题,该问题与assetlinks.json文件无关。我有3个不同的领域,其中一个是由于一些错误的配置而失败。即使只有一个域失败,applink也不能用于其他域。您可能需要检查所有域是否都按预期工作

查看此链接建议使用intenturl的方法很好,我正在成功地使用它,但它只适用于可以更改html的地方。我希望能够打开常规的http URL(因为它们出现在谷歌搜索结果中)。有一件事可以帮助我。您需要修复
意图过滤器中的
数据
部分。数据标记应包括以下所有参数:
。对于每个方案、主机等,应添加相同的数据。上面的检查示例是坏建议;每个
数据
标记使用一个属性是完全合理的,事实上,大多数谷歌应用程序清单都使用这种样式。@j_\m,谢谢!你的建议对我有帮助。我有这样的东西。有什么问题吗?@Chamnap是的,您应该返回assetlinks.json文件的内容,并返回一个包含“debugString”的页脚“******************************************************************************\nNone!”谢谢!在我的例子中,
AndroidManifest
中有两个域。删除其中任何一个后,应用程序链接工作!在日志中,我得到:
I/intentfilteringtentop:Verification 2 complete。成功:没错。失败的主机:。
。目前正在搜索如何使这两个域都工作。@j_um的建议很有帮助。我用一个属性设置所有
标记。
https://digitalassetlinks.googleapis.com/v1/statements:list?
source.web.site=https://<domain1>:<port>&
relation=delegate_permission/common.handle_all_urls