Flutter android 12 deep link is not working

2.1k views Asked by At

Android 12 deep link is not working tried so many ways but not getting solution its open the link in browser not in app. I am sharing all the stuff that i tried please let me know where is something going wrong . Link is working fine on less 12 devices
Manifest `


package="com.erecord.erecordstudio"




<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="erecordstudio.com" />
    <data android:scheme="https" />
</intent-filter>

`

My digital asset json is at https://erecordstudio.com/.well-known/assetlinks.json `

[
  {
    "relation": [
      "delegate_permission/common.handle_all_urls"
    ],
    "target": {
      "namespace": "android_app",
      "package_name": "xxx.xxxx.xxxxx",
      "sha256_cert_fingerprints": [
        "xxxxx",
        ]
    }
  }
]


 
Getting this sha when runnging keytool command in terminal
 keytool -list -v -keystore /my_jks.jks

 

    

This is the asset json which is Google console app integrity 


    [
  {
    "relation": ["delegate_permission/common.handle_all_urls"],
    "target": {
      "namespace": "android_app",
      "package_name": "xxx.xxxx.xxxxx",
      "sha256_cert_fingerprints":
        ["xxxxxx"]
    }
  }
]



when hitting this  url to cross check it says wrong content type 

[link_to_check_ditigal_asset_json]
https://%20https://digitalassetlinks.googleapis.com/v1/statements:list?source.web.site=https://erecordstudio.com&relation=delegate_permission/common.handle_all_urls

it says
    {
  "maxAge": "599.999999883s",
  "debugString": "********************* ERRORS *********************\n* Error: unavailable: Wrong content type in HTTP response headers while fetching statements from https://erecordstudio.com./.well-known/assetlinks.json (which is equivalent to 'https://erecordstudio.com/.well-known/assetlinks.json'): expected 'Content-Type: application/json' but found application/octet-stream [1] while fetching Web statements from https://erecordstudio.com./.well-known/assetlinks.json (which is equivalent to 'https://erecordstudio.com/.well-known/assetlinks.json') using download from the web (ID 1).\n********************* INFO MESSAGES *********************\n* Info: No statements were found that match your query\n",
  "errorCode": [
    "ERROR_CODE_WRONG_CONTENT_TYPE"
  ]
}

if this was the issue than how can i fix this content type application/json error 

and also tried with this command  

adb shell dumpsys package com.erecord.erecordstudio
it says

Domain verification status:
  com.erecord.erecordstudio:
    ID: 6d85377d-f25b-4c5d-a894-93970b2388c6
    Signatures: [xxxxxx]
    Domain verification state:
      erecordstudio.com: legacy_failure
    User all:
      Verification link handling allowed: true
      Selection state:
        Disabled:
          erecordstudio.com



> Now where i am doing mistake whats the wrong with this.
I am frustrated now please help to find out the solution      
2

There are 2 answers

1
lokendra birla On BEST ANSWER

I found this issue go to browser inspect and go to network and there check content-type and its issue in server don't have permission to content-type json file permission.

in server /opt/lampp/etc httpd.config

ou can use the following code in your httpd.conf if you have access, or even your .htaccess , to force Apache, to send an UTF-8 encoding header.

AddType 'application/json;' .json

1
Ellet On

For me, I fixed it by adding the SHA-256 of the debug key in my PC and the release upload key in the sha256_cert_fingerprints array as String so the app links work in debug (when run the app from your machine or generate the apk and sign in using) and release version in google play etc...