如何将 link 带有数字资产 link 协议的网站用于 Instant 应用程序?

how to link website with digital asset link protocol for Instant app?

我上个星期就卡住了,我无法上传免安装应用程序 apk。 我正在获取 "Your site 'sptechinfo.000webhostapp.com' has not been linked through the Digital Assets Link protocol to your app. Please link your site through the Digital Assets Link protocol to your app"

我已经添加了 assetlink.json AssetLink.json 但在 Playstore 上仍然遇到同样的错误。

我从这里 https://digitalassetlinks.googleapis.com/v1/statements:list?source.web.site=http://sptechinfo.000webhostapp.com&relation=delegate_permission/common.handle_all_urls 验证了 link 但得到同样的错误。

这是我在 string.xml 文件中的 asset_statements [{\n \"relation\": [\"delegate_permission/common.handle_all_urls\"],\n \"target\": {\n \"namespace\": \"web\",\n \"site\": \"http://sptechinfo.000webhostapp.com\",\n }\n}]

请任何人帮助我解决这个问题。

参考:Instant App - Digital Asset Links Protocol

当我从我的调试密钥而不是发布密钥生成一个 assetlinks.json 文件时,这发生在我身上。它在 Android Studio 中显示为已验证,然后在服务器上失败。仔细检查您的资产 links 文件的签名配置是否正确,以及文件中的指纹是否与您的发布密钥的 SHA256 指纹匹配。您可以通过 运行

获取您的发布密钥的指纹
keytool -list -v -keystore ~/my_keystore.jks

另一个原因可能是您启用了 Play 签名。在这种情况下,您必须使用开发人员控制台中提供的指纹,而不是您在本地为 APK 签名的密钥指纹(本地指纹称为您的 "upload key")。这在 Android Studio 中根本不明显,因为它的资产 link 文件生成器没有为您提供放置自定义指纹的选项。