Digital Assets Link link to my website
Asked Answered
P

7

11

I have created an instant app. I uploaded it to my Google Console, and I got this error.

The www.kochchy.cz website has not been linked to your application through the Digital Assets Link protocol. Link the application site with Digital Assets Link.

[{
  "relation": ["delegate_permission/common.handle_all_urls"],
  "target": {
   "namespace": "android_app",
    "package_name": "com.kochchy.instantapptest.app",
    "sha256_cert_fingerprints":["A4:A6:74:15:F1:3E:38:3F:93:0F:EF:E3:A6:86:8E:7C:25:45:E8:80:5B:5E:35:70:49:20:DB:F8:CB:D4:FC:E0"]
  }
}] 

Both apks, instant and installable use same id: com.kochchy.instantapptest.app (each defined in own module manifests)

My base module manifest looks like this:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.kochchy.instantapptest">

<uses-permission android:name="android.permission.INTERNET" />

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:theme="@style/AppTheme">

    <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:theme="@style/AppTheme.NoActionBar">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>

        <meta-data
            android:name="default-url"
            android:value="https://www.kochchy.cz" />

        <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:scheme="https" />
            <data android:scheme="http" />
            <data android:host="www.kochchy.cz" />
            <data android:pathPattern="/menu" />
        </intent-filter>
    </activity>
</application>
</manifest>

------ EDIT ------

I made new project from google instant app sample: https://github.com/googlesamples/android-instant-apps/tree/master/hello

Same google console error. I guess there is problem in my web setup, not in the app.

The www.kochchy.cz website has not been linked to your application through the Digital Assets Link protocol. Link the application site with Digital Assets Link.

Preconize answered 12/6, 2017 at 11:8 Comment(5)
I'm not sure you should post your certificate fingerprint for all the world to seePenultimate
are you using released key store to in digital assets. "sha256_cert_fingerprints": ["A4:A6:74:15:F1:3E:38:3F:93:0F:EF:E3:A6:86:8E:7C:25:45:E8:80:5B:5E:35:70:49:20:DB:F8:CB:D4:FC:E0"] should be of your ketstore not debug oneGoldthread
yes, im using release keyPreconize
Same issue here. used one of the google examples. changed the url. I am absolutely sure the sha cert is correct, because i have used it before for deep linking. Did you solve it?Outguess
Two things you can double check. First, make sure you pass this test: developers.google.com/digital-asset-links/tools/generator. Second, make sure the “Link and Verify” in this step passes 100% developer.android.com/studio/write/…Vaillancourt
P
27

So for me, and maybe this is obvious to some, was the usage of the wrong sha key. What you need to do is go to your https://play.google.com/apps/publish/ console

Go to Release Management then to the App Signing page. Copy the SHA256 key from there.

Go to https://developers.google.com/digital-asset-links/tools/generator and enter the sha key, url and packagename there.

Upload this file to https://example.com/.well-known/assetlinks.json

Make sure that the file is in the correct location: A folder named .well-known.

Release your instant app

Postobit answered 24/10, 2018 at 9:56 Comment(2)
this is interesting how simple one developer explain vs google documentation.Beautician
Now SHA256 key is not in App Signing page, but under Setup -> App integrityWarrantee
C
3

In your json file, the field package_name is set to com.kochchy.instantapptest.app.

However, the package name in your AndroidManifest.xml is set to com.kochchy.instantapptest.

They should match.

EDIT

Your structure looks pretty different from the one recommended by Google.

You shouldn't have to duplicate your code and resources. Instead, create a third module(let's call it base) to act as the base feature module, and move all your code and resources to there. Make sure its build.gradle includes these lines:

apply plugin: 'com.android.feature'

android {
    baseFeature true
    ...
}

dependencies {
    application project(':app')
    ...
}

In your app's build.gradle, make sure you have these lines in:

apply plugin: 'com.android.application'
...
dependencies {
    implementation project(':base')
}

Finally, in your instantapp's build.gradle:

apply plugin: 'com.android.instantapp'
...
dependencies {
    implementation project(':base')
}

You might need to make further changes, but this should be a good start. I strongly recommend you to take a look at this page, specially the section "Structure of a basic instant app".

Coppock answered 12/6, 2017 at 17:40 Comment(2)
im sorry, i didnt tell this is my base manifest, in my instant-app manifest i have com.kochchy.instantapptest.appPreconize
@Preconize The instant app and the installable app should share the same package name, according to this FAQ: developer.android.com/topic/instant-apps/faqs.html. Have you tried to change the package_name value to com.kochchy.instantapptest in your assetlinks.json file?Coppock
G
2
"package_name": "com.kochchy.instantapptest.app"

Here you should have your application Id from installable app not from instant app manifest

defaultConfig {
    applicationId "com.example.yourappid"
}
Goldthread answered 13/6, 2017 at 12:54 Comment(1)
both of them, instant and installable use same id: com.kochchy.instantapptest.appPreconize
S
2

Try following these steps and verify that the generated file is the same as yours:

Tools -> App Links Assistant -> (Click Button) Open Digital Asset Links File Generator

After you complete everything, click Generate Digital Asset Links file.

Click Save file to download it.

Upload the assetlinks.json file to your site, with read-access for everyone, at https://www.exemple.com/.well-known/assetlinks.json.

Click Link and Verify to confirm that you've uploaded the correct Digital Asset Links file to the correct location.

Reference: https://developer.android.com/studio/write/app-link-indexing.html#associatesite

Stallard answered 16/8, 2017 at 12:22 Comment(1)
i tried bro but same problem can you please check where am doing wrongBobo
B
1

problem with sha256_cert_fingerprints. Application app singing was enabled so I copied sha from google play console and put that into asserlink.json file and it works .

https://d5rwdr23d4fqx.cloudfront.net/.well-known/assetlinks.json

only google play console gives me this error

even android studio saying ok

good tool saying ok

Bobo answered 21/1, 2018 at 11:16 Comment(0)
C
0

check the assetlinks.json. has file permissions are executable to public

by default it may only readable to public . and then make sure if enable google play app signing use the ssh key which provided in play console .

Cockboat answered 10/9, 2018 at 6:59 Comment(0)
A
0

In my case, it was the following: https://mcmap.net/q/348440/-app-links-intent-filters-in-assetlinks-json-not-working-on-android

If you have done everything else correctly and are pulling your hair, consider ensuring that the file you added to your web server has the correct encoding (without BOM, in my case). Thank you, Visual Studio! :/

Aggrieve answered 5/10, 2018 at 20:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.