2

I'm having the problem that the lint test for AppLinksAutoVerifyWarning is always failing with the error message:

App Links Auto Verification Failure ../../src/debug/AndroidManifest.xml:17: This host does not support app links to your app. Checks the Digital Asset Links JSON file: https://myhost/.well-known/assetlinks.json

I'm using a target specific AndroidManifest for debug builds, as you can see above. For those debug builds I append a .debug suffix to my package name. So debug builds will have package id mypackage.debug and Release builds will get just mypackage. Both builds are signed with the same release key (due to sharedUserId) and I made sure that the fingerprint in the assetlinks.json matches the signed one. For myhost there is a valid ssl certificate.

I uploaded the assetlinks.json file with support for mypackage.debug an mypackage and made sure that it has the correct application/json mimetype.

  • On the Phone the app linking works fine
  • Validating with digitalassetlinks.googleapis.com/v1/statements:list?source.web.site=https://myhost&relation=delegate_permission/common.handle_all_urls does not provide any errors
  • Testing the AppLink with adb shell am start -a android.intent.action.VIEW -c android.intent.category.BROWSABLE -d "http://myhost" works fine
  • I recreated, uploaded and tested the assetlinks.json with developers.google.com/digital-asset-links/tools/generator which validates ok and does not produce a json file with different content
  • Validated json syntax using textmate
  • I also tried moving the intent-filter from the debug AndroidManifest to the main manifest, moving it to other activities which don't have another intent-filter

So everything seems to be fine, just lint isn't working. I could just disable the lint check but I rather would like to have it on so I'm aware when there is a real problem.

One thing I observed: if I change the intent-filter for the app link from https to http the error message from lint changes to: ... has incorrect JSON syntax which is even more strange because android itself and the google validation services seem to validate it fine. (might be related that we forward all traffic from http to https)

current intent-filter is:

  <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:host="myhost"
                    android:pathPrefix="/open_app"
                    android:scheme="https"/>


   </intent-filter>
scholt
  • 150
  • 2
  • 8

1 Answers1

0

I just had the same issue, so I looked at the source code for the lint check:

            switch (result.getValue().mStatus) {
            case STATUS_HTTP_OK:
                List<String> packageNames = getPackageNameFromJson(
                        result.getValue().mJsonFile);
                if (!packageNames.contains(packageName)) {
                    context.report(ISSUE_ERROR, host, context.getLocation(host), String.format(
                            "This host does not support app links to your app. Checks the Digital Asset Links JSON file: %s",
                            jsonPath));
                }
                break;

It was failing for me because the package name in the assetlinks.json did not match the one in my manifest. Turns out someone on my team only half finished converting our top level project into a library project, and changed the top level projects package name. But this could also happen if the assetlinks.json has a typo on the package name.

OldSchool4664
  • 1,454
  • 17
  • 13