androidapplinksandroid-instant-appsgoogle-play-consoledigital-assets-links

Android Instant App - Play Console release/deploy error and DAL(digital Asset Link) not linked


I'm trying to figure out why the play store will not accept my instant app build. I have successfully deployed an Alpha regular app release to testers since it is a prerequisite to release an instant app. I am trying to deploy a development release instant app. What am I doing wrong? I tried to add as much detail as possible.

Do I need to use the Digital Asset Link API service at the following link for a production instant app or is that for something else? https://console.developers.google.com/apis/api/digitalassetlinks.googleapis.com/overview

I get the following error when uploading the instant app build to the play console:

Your site 'example.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.

One thing i'm a little confused about is why when I click link and verify that a get the error message "Adding asset statements failed." as shown in the following picture: Adding asset statements failed I notice that when I click the link and verify button, it modifies the strings.xml file in base and adds the following string: <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>

I have the following in the manifest of base, checklist and advisor under the application tag: <meta-data android:name="asset_statements" android:resource="@string/asset_statements"/>

Project description and structure:

App description: This is a proof of concept app. The installable app will open the mainfeature activity with two buttons that will bring you to either the checklist or advisor activity when clicked. There are two instant apps, instantapp-checklist goes to the checklist activity and instantapp(advisor) goes to the advisor activity.

Project structure

My assetlinks.json is:

[{
  "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"]
  }
}]

In my checklist manifest inside the activity tag is the following:

        <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:


Solution

  • In the assetlinks.json file, the field package_name is set to blah.blah1.blah2.myappname.checklist.

    However, mentioned above is that the installable app's id is blah.blah1.blah2.myappname. That means the package_name in the AndroidManifest.xml is set to blah.blah1.blah2.myappname.

    They should match. blah.blah1.blah2.myappname must be added to the assetlinks.json on the server.

    In the strings.xml, change the 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>
    

    Here are some other notes that helped me find the solution: