Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

deep linking - Flutter Application Won't Verify App Link On Android

I'm trying to have my application use app links, but even though I went through all the steps and my assetlinks.json file is being requested, the disambiguation box still shows up. I tried the same steps with a native android app, and it worked without showing the box. Here is what I did:

1- Create a new flutter application. 2- Signed my application following the instructions on https://flutter.dev/docs/deployment/android 3- Add the following to my activity in AndroidManifest.xml

<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"
                    android:host="<example.come>" />
            </intent-filter>

I replaced example.com with my own domain, have https enabled, and serving /.well-known/assetlinks.json

Here is the content of assetlinks.json

[
    {
        "relation": [
            "delegate_permission/common.handle_all_urls"
        ],
        "target": {
            "namespace": "android_app",
            "package_name": "com.example.app",
            "sha256_cert_fingerprints": [
                "hash_of_app_certificate"
            ]
        }
    }
]

I replaced com.example.app with my own, and changed the hash. I used this command to obtain the hash keytool -list -v -keystore <keystore path> -alias <key alias> -storepass <store password> -keypass <key password>

4- Ran flutter build apk and installed the app on my device. I can tell that assetlinks.json has been requested from the server, but the selection box still shows up.

I tested my assertlinks.json on https://developers.google.com/digital-asset-links/tools/generator and it says it is successful so whatever is wrong is on the app side.

What am I missing or doing wrong?

Here is my flutter doctor --verbose

[√] Flutter (Channel stable, 1.22.5, on Microsoft Windows [Version 10.0.19041.746], locale en-US)
    ? Flutter version 1.22.5 at C:flutter
    ? Framework revision 7891006299 (7 weeks ago), 2020-12-10 11:54:40 -0800
    ? Engine revision ae90085a84
    ? Dart version 2.10.4

[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    ? Android SDK at C:UsersMoneerAppDataLocalAndroidSdk
    ? Platform android-29, build-tools 29.0.3
    ? ANDROID_HOME = C:UsersMoneerAppDataLocalAndroidSdk
    ? Java binary at: C:Program FilesAndroidAndroid Studiojreinjava
    ? Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
    ? All Android licenses accepted.

[!] Android Studio (version 4.1.0)
    ? Android Studio at C:Program FilesAndroidAndroid Studio
    X Flutter plugin not installed; this adds Flutter specific functionality.
    X Dart plugin not installed; this adds Dart specific functionality.
    ? Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)

[√] VS Code (version 1.52.1)
    ? VS Code at C:UsersMoneerAppDataLocalProgramsMicrosoft VS Code
    ? Flutter extension version 3.18.1

[√] Connected device (1 available)
    ? sdk gphone x86 64 arm64 (mobile) ? emulator-5554 ? android-x64 ? Android 11 (API 30) (emulator)

! Doctor found issues in 1 category.

question from:https://stackoverflow.com/questions/65915334/flutter-application-wont-verify-app-link-on-android

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...