首页 文章

Android Instant App - Play控制台发布/部署错误和DAL(数字资产链接)未链接

提问于
浏览
3

我疯狂地想弄清楚游戏商店为什么不接受我的即时应用程序构建 . 我已经成功地向测试人员部署了一个 Alpha 常规应用程序版本,因为它是发布即时应用程序的先决条件 . 我正在尝试部署一个 development 发布即时应用程序 . 我究竟做错了什么?我试图尽可能多地添加细节 . 如果您需要更多信息,请与我们联系 .

我是否需要在以下链接中使用数字资产链接API服务来生成即时应用程序,还是其他内容? https://console.developers.google.com/apis/api/digitalassetlinks.googleapis.com/overview

将即时应用程序版本上传到播放控制台时出现以下错误:

您的网站“example.com”尚未通过数字资产链接协议链接到您的应用 . 请通过Digital Assets Link协议将您的网站链接到您的应用 .

我有点困惑的一件事是,为什么当我点击 link and verify 时收到错误消息“添加资产报表失败” . 如下图所示:
Adding asset statements failed
我注意到当我单击 link and verify 按钮时,它会修改base.xml中的strings.xml文件并添加以下字符串: <string name="asset_statements" translatable="false">[{\n \"relation\": [\"delegate_permission/common.handle_all_urls\"],\n \"target\": {\n \"namespace\": \"web\",\n \"site\": \"https://example.com\",\n }\n}]</string>

我在应用程序标记下的基础,清单和顾问清单中有以下内容: <meta-data android:name="asset_statements" android:resource="@string/asset_statements"/>

Project description and structure:

应用说明:这是一个概念验证应用程序 . 可安装的应用程序将使用两个按钮打开mainfeature活动,这些按钮将在您单击时显示清单或顾问程序活动 . 有两个即时应用程序,instantapp-checklist进入清单活动,而instantapp(顾问)进入顾问活动 .

  • 有3个功能模块:mainfeature,checklist,advisor

  • 有2个即时应用程序:instantapp-checklist,instantapp(顾问)

Project structure

  • 我的可安装应用程序包是:blah.blah1.blah2.myappname

  • 我的清单即时应用程序的包ID是:blah.blah1.blah2.myappname.checklist

  • 我的顾问即时应用程序的包ID是:blah.blah1.blah2.myappname.advisor

我的assetlinks.json是:

[{
  "relation": ["delegate_permission/common.handle_all_urls"],
  "target": {
    "namespace": "android_app",
    "package_name": "blah.blah1.blah2.myappname.checklist",
    "sha256_cert_fingerprints":
    ["AA:...:53"]
  }
},
{
  "relation": ["delegate_permission/common.handle_all_urls"],
  "target": {
    "namespace": "android_app",
    "package_name": "blah.blah1.blah2.myappname.advisor",
    "sha256_cert_fingerprints":
    ["AA:...:53"]
  }
}]

在我的清单中,活动标签内的清单如下:

<meta-data
            android:name="default-url"
            android:value="https://example.com/checklist.html"/>

        <intent-filter>
            <action android:name="android.intent.action.MAIN"/>

            <category android:name="android.intent.category.LAUNCHER"/>
        </intent-filter>
        <intent-filter android:order="1"
                       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"
                android:host="example.com"
                android:pathPattern="/checklist.html"/>
            <data android:scheme="https"/>
        </intent-filter>

Self checks I've done:

  • 即时应用程序已使用我的密钥库签名签名,而不是使用调试密钥签名 . 我检查确保即时应用程序和assetlinks.json显示相同的sha256指纹 .

  • robots.txt允许所有机器人搜索assetlinks.json

  • assetlinks.json确实有一个有效的证书并允许https

  • assetlinks.json标头的内容类型是application / json

  • 我不是选择参加"Google Play App Signing"

  • 我使用以下网站测试我的陈述并且成功:https://developers.google.com/digital-asset-links/tools/generator

一切都有帮助,谢谢你提前!!!

2 回答

  • 0

    这很奇怪,我有同样的问题 . 解决方案很简单;

    正如@ olearyj234中提到的Link和Verify按钮将字符串添加到string.xml的末尾 .

    我只是删除string.xml中的新字符串,然后单击“链接并验证”按钮 .

  • 1

    assetlinks.json 文件中,字段package_name设置为blah.blah1.blah2.myappname.checklist .

    但是,上面提到的是 installable app's id 是blah.blah1.blah2.myappname . 这意味着AndroidManifest.xml中的package_name设置为blah.blah1.blah2.myappname .

    他们应该匹配 . 必须将blah.blah1.blah2.myappname添加到服务器上的assetlinks.json .

    在strings.xml中,更改asset_statements:

    <string name="asset_statements" translatable="false">[{\n  \"relation\": [\"delegate_permission/common.handle_all_urls\"],\n  \"target\": {\n    \"namespace\": \"web\",\n    \"site\": \"https://qaapps.cio.ny.gov/apps/sandbox/james/hesc/checklist.html\",\n  }\n},{\n  \"relation\": [\"delegate_permission/common.handle_all_urls\"],\n  \"target\": {\n    \"namespace\": \"web\",\n    \"site\": \"https://qaapps.cio.ny.gov/apps/sandbox/james/hesc/advisor.html\",\n  }\n}]</string>
    

    以下是一些帮助我找到解决方案的其他说明:

    • 我使用以下命令行来测试即时应用程序是否有效: adb shell am start -a android.intent.action.VIEW -d "https://example.com/checklist/"

    • 在设备上,我转到设置> Google>即时应用,然后点击切换到卸载/关闭即时应用,然后再次单击它以将其重新打开 . 还转到了Chrome设置(设置>隐私>清除浏览数据)以清除时间范围内的所有数据,所有时间 .

    • 在Chrome中输入即时应用的网址时,它只会打开网站,而不是即时应用 . 如果我点击网站中即时应用程序的链接,它会打开即时应用程序而不是网站 .

相关问题