App links intent filters in assetlinks.json not working on Android

前端 未结 12 1882
时光取名叫无心
时光取名叫无心 2020-12-02 17:12

My app defines the intent filters to handle URL\'s from my site defined by


  

        
12条回答
  •  醉梦人生
    2020-12-02 17:28

    For me, it was the fact that my assetlinks.json file was UTF-8 and contained a byte-order mark (BOM), which is a three-byte magic number at the head of the file that signals the encoding to a consuming program. The BOM is optional, and apparently the Google / Android tools do not like to see it. When it was present, Google's digital asset links verifier (URL below) gave me a "malformed JSON" error.

    If you're using Visual Studio, here's how to determine if you have the BOM in your file, and remove it if necessary:

    1. Right-click your assetlinks.json file.
    2. Choose "Open With..." from the context menu.
    3. Choose "Binary Editor" in the "Open With" dialog.
    4. Examine the file bytes. If the file starts with EF BB BF, that's the problem.
    5. Delete those characters (you can do this via either column) and save the file.
    6. Re-upload the file and test it using the Google tools (URLs below) and it should work properly for you.

    Here's the URL you can use to check your file (replace example.com with your actual URL):

    https://digitalassetlinks.googleapis.com/v1/statements:list?source.web.site=https://example.com&relation=delegate_permission/common.handle_all_urls

提交回复
热议问题