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. 网络问题
  • 在某些情况下,用户的网络连接问题可能导致深链接无法成功打开应用。
相关推荐
花花鱼8 分钟前
html5与android之间相互调用
android
aqi001 小时前
FFmpeg开发笔记(八十八)基于Compose的国产电视直播开源框架MyTV
android·ffmpeg·音视频·直播·流媒体
●VON2 小时前
双非大学生自学鸿蒙5.0零基础入门到项目实战 -《基础篇》
android·华为·harmonyos·鸿蒙
urkay-2 小时前
Android Cursor AI代码编辑器
android·人工智能·编辑器·iphone·androidx
pedestrian_h10 小时前
操作系统-线程
android·java·开发语言
gfdgd xi11 小时前
GXDE 内核管理器 1.0.1——修复bug、支持loong64
android·linux·运维·python·ubuntu·bug
美狐美颜sdk11 小时前
跨平台直播美颜sdk集成攻略:Android、iOS与Web的统一方案
android·前端·ios
❀͜͡傀儡师12 小时前
二维码/条码识别、身份证识别、银行卡识别、车牌识别、图片文字识别、黄图识别、驾驶证(驾照)识别
android·scanner
生莫甲鲁浪戴13 小时前
Android Studio新手开发第三十五天
android·ide·android studio