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. 网络问题
  • 在某些情况下,用户的网络连接问题可能导致深链接无法成功打开应用。
相关推荐
千里马学框架3 天前
一起学 Android 14:ShellTransition 屏幕旋转过程深度剖析
android·智能手机·性能优化·framework·性能·屏幕旋转·rotation
美狐美颜SDK开放平台3 天前
开发直播APP时如何接入视频美颜SDK?开发流程与注意事项
android·人工智能·计算机视觉·音视频·直播美颜sdk
AFinalStone3 天前
Android7 SystemUI源码解析(七)Keyguard锁屏模块深度解析
android·systemui
致远ccc3 天前
Google Play 上架前如何测试 App?多国家 Android 环境测试
android·app测试·googleplay·多国家应用测试
ttyyttemo3 天前
Kotlin 协程中的 Job 结构化并发与取消
android
sun0077003 天前
tbox 4g/5g切换,导致wan ip 改变,导致车机旧网络不可用。需要重启车机才行
android
其实防守也摸鱼3 天前
内网穿透与反向代理:原理、工具与实战指南
android·大数据·运维·安全·网络安全·自动化·渗透
AFinalStone3 天前
Android7 SystemUI 源码解析(四)NavigationBar 导航栏与 SystemBars
android·systemui
JMchen3 天前
属性动画原理与高级动画实现
android·kotlin·canvas
AFinalStone3 天前
Android7 SystemUI 源码解析(二)启动流程深度解析
android·systemui