Flutter 应用程序不会在 Android 上验证应用程序链接

问题描述

我正在尝试让我的应用程序使用应用程序链接,但即使我完成了所有步骤并且请求了我的 assetlinks.json 文件,消歧义框仍然显示。我在原生 android 应用程序上尝试了相同的步骤,但它没有显示框就可以工作。这是我所做的:

1- 创建一个新的 Flutter 应用程序。 2- 按照 https://flutter.dev/docs/deployment/android 上的说明签署了我的申请 3- 将以下内容添加到我在 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>

我用我自己的域替换了 example.com,启用了 https,并提供了 /.well-kNown/assetlinks.json

这里是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"
            ]
        }
    }
]

我用自己的替换了 com.example.app,并更改了哈希值。我用这个命令来获取哈希 keytool -list -v -keystore <keystore path> -alias <key alias> -storepass <store password> -keypass <key password>

4- 运行 Flutter build apk 并在我的设备上安装该应用程序。我可以看出服务器已请求 assetlinks.json,但选择框仍然显示

我在 https://developers.google.com/digital-asset-links/tools/generator 上测试了我的 assertlinks.json,它说它成功了,所以无论是在应用程序方面出了什么问题。

我遗漏了什么或做错了什么?

这是我的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:\Users\Moneer\AppData\Local\Android\Sdk
    • Platform android-29,build-tools 29.0.3
    • ANDROID_HOME = C:\Users\Moneer\AppData\Local\Android\Sdk
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • 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 Files\Android\Android 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:\Users\Moneer\AppData\Local\Programs\Microsoft 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.

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)