Issue id: AppLinkUrlError 应用intent-filter 配置深链接 URL 问题分析 | AndroidManifest

AndroidManifest.xml 配置文件中,对 activity 组件进行声明的时候,独立应用在 IDE 显示 intent-filter 报错,但不影响实际编译,因为是系统应用,肯定会有此 URL 的存在。

AOSP 源码:

XML 复制代码
        <activity android:name="Settings$ApnEditorActivity"
                android:configChanges="orientation|keyboardHidden|screenSize"
                android:exported="true"
                android:label="@string/apn_edit">
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <action android:name="android.intent.action.EDIT" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:mimeType="vnd.android.cursor.item/telephony-carrier" />
            </intent-filter>

            <intent-filter>
                <action android:name="android.intent.action.INSERT" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:mimeType="vnd.android.cursor.dir/telephony-carrier" />
            </intent-filter>
            <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
                       android:value="com.android.settings.network.apn.ApnEditor" />
            <meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
                       android:value="@string/menu_key_network"/>
        </activity>

AndroidManifest.xml

问题

红线说明:

Missing URL More... (Ctrl+F1)

Inspection info: Ensure your intent filter has the documented elements for deep links, web links, or Android App Links.

Issue id: AppLinkUrlError

More info: https://developer.android.com/training/app-links https://g.co/AppIndexing/AndroidStudio

Vendor: Android Open Source Project

Contact: https://groups.google.com/g/lint-dev

Feedback: https://issuetracker.google.com/issues/new?component=192708
Missing URL 的完整说明

IDE提示的解决建议中,set scheme是没有用的,通过忽略的配置可以不显示红线
IDE提示的解决建议

解决方案

intent-filter 配置tools:ignore="AppLinkUrlError"

显示正常代码:

XML 复制代码
            <intent-filter tools:ignore="AppLinkUrlError">
                <action android:name="android.intent.action.VIEW" />
                <action android:name="android.intent.action.EDIT" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:mimeType="vnd.android.cursor.item/telephony-carrier" />
            </intent-filter>

LinkUrl介绍

AppLinkUrlError 错误

AppLinkUrlError 是与 Android 应用的深度链接(Deep Linking)和应用链接(App Links)相关的一个错误。该错误通常指示在尝试解析或打开某个特定的 URL 时出现了问题,这些问题可能导致链接无法正确打开到指定的应用或页面。

应用中的深链接 URL 可能存在多种问题,这些问题可能会导致用户无法正确访问应用的特定内容或功能。以下是一些常见的深链接相关问题:

  1. URL 格式不正确
  • 深链接的格式必须符合 URI 标准。如果 URL 中包含非法字符、拼写错误或格式不符合规范,可能导致链接无效。
  1. 未注册的深链接
  • 如果应用未正确在 Manifest 文件中声明其深链接,系统将无法识别并处理这些链接。这可能会导致用户点击链接后出现错误页面或无法打开应用。
  1. 不匹配的 URI 模式
  • 应用可能设置了特定的 URI 模式(例如:https://www.example.com/path),如果请求的链接不符合这些模式,应用将无法处理请求。
  1. 缺少必要的参数
  • 深链接通常需要附加参数(例如,ID 或查询字符串)以导向特定的内容。如果缺少这些必要的参数,用户可能无法访问正确的页面或功能。
  1. 授权和权限问题
  • 某些深链接可能需要用户授权,或者依赖于用户的登录状态。如果用户未登录或未授权,深链接可能无法正常工作。
  1. 平台兼容性
  • 不同平台或操作系统版本可能对深链接的支持程度不同。某些老旧版本的 Android 或 iOS 可能不完全支持深链接功能。
  1. 过期的链接
  • 如果深链接指向的内容已被删除或移除,用户在访问时将得到一个错误页面(例如 404 Not Found)。
  1. App 版本不兼容
  • 深链接可能在特定版本的应用中有效。如果用户安装的应用版本不支持该深链接指向的功能或内容,链接将无法正常工作。
  1. 网络问题
  • 在某些情况下,用户的网络连接问题可能导致深链接无法成功打开应用。
相关推荐
不爱说话郭德纲10 小时前
告别漫长的HbuilderX云打包排队!uni-app x 安卓本地打包保姆级教程(附白屏、包体积过大排坑指南)
android·前端·uni-app
Sinclair14 小时前
简单几步,安卓手机秒变服务器,安装 CMS 程序
android·服务器
雮尘17 小时前
手把手带你玩转Android gRPC:一篇搞定原理、配置与客户端开发
android·前端·grpc
ktl19 小时前
Android 编译加速/优化 80%:一个文件搞定,零侵入零配置
android
alexhilton1 天前
使用FunctionGemma进行设备端函数调用
android·kotlin·android jetpack
冬奇Lab1 天前
InputManagerService:输入事件分发与ANR机制
android·源码阅读
张小潇1 天前
AOSP15 Input专题InputManager源码分析
android·操作系统
RdoZam2 天前
Android-封装基类Activity\Fragment,从0到1记录
android·kotlin
奥陌陌2 天前
android 打印函数调用堆栈
android
用户985120035832 天前
Compose Navigation 3 深度解析(二):基础用法
android·android jetpack