Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

  • There are 3 feature modules: mainfeature, checklist, advisor
  • There are 2 instant apps: instantapp-checklist, instantapp(advisor)

Project structure

  • My installable app's bundle is is: blah.blah1.blah2.myappname
  • My checklist instant app's bundle id is: blah.blah1.blah2.myappname.checklist
  • My advisor instant app's bundle id is: blah.blah1.blah2.myappname.advisor

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:

  • The instant app was signed signed with my keystore, not with the debug key. I checked to make sure the instant app's and the assetlinks.json show the same sha256 fingerprint.
  • The robots.txt allows assetlinks.json to be searched by all robots
  • assetlinks.json does have a valid cert and allows https
  • The content-type of assetlinks.json header is application/json
  • I am not opt'd in for "Google Play App Signing"
  • I used the following site to test my statement and it is successful: https://developers.google.com/digital-asset-links/tools/generator
like image 394
James Avatar asked Oct 30 '22 03:10

James


1 Answers

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:

  • I used the following command line to test if the instant app works: adb shell am start -a android.intent.action.VIEW -d "https://example.com/checklist/"
  • On the device, I went to Settings > Google > Instant Apps and clicked the switch to uninstall/turn-off instant apps, then click it again to turn it back on . Also went to the Chrome settings(Settings > Privacy > Clear Browsing Data) to clear all data for time range, All Time.
  • When typing in the url to the instant app in Chrome, it only opens the website and not the instant app. If I click on a link to the instant app in a website it does open the instant app instead of the website.
like image 133
James Avatar answered Nov 11 '22 12:11

James