创建 flutter 的深层链接时显示此错误

问题描述 投票:0回答:1

我已经在 flutter app -> android -> src -> main -> androidmanifest.xml 中添加了这段代码,但现在仍然可以工作

<!-- Intent filter for handling deep links -->
<intent-filter>
    <action android:name="android.intent.action.VIEW" />

    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />

    <!-- Accepts URIs that begin with "https://www.example.com/gizmos" -->
    <data
        android:scheme="https"
        android:host="www.example.com"
        android:pathPrefix="/gizmos" />
</intent-filter>

添加后仍然不起作用

android flutter deep-linking
1个回答
0
投票

确保意图过滤器放置在您要处理深层链接的标签内。它应该嵌套在标签内,而不是仅仅嵌套在 AndroidManifest.xml 中的任何位置。

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="your.package.name">
<application>
    <activity android:name=".MainActivity">
        <!-- ... other configurations ... -->

        <!-- Intent filter for handling deep links -->
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />

            <!-- Accepts URIs that begin with "https://www.example.com/gizmos" -->
            <data
                android:scheme="https"
                android:host="www.example.com"
                android:pathPrefix="/gizmos" />
        </intent-filter>
    </activity>

    <!-- ... other activities ... -->
</application>
© www.soinside.com 2019 - 2024. All rights reserved.