点击Deep Link URL后Android应用无法启动,寻求解决办法
问题分析与修复方案
你的Deep Link无法触发应用,核心问题是Intent Filter的Scheme配置和目标URL不匹配,同时多Data标签的组合逻辑也存在问题,以下是具体修复步骤:
1. 核心问题:Scheme不匹配
你点击的链接是https://www.omega.dk/app/examptpassword,使用的是https协议,但你的配置里用的是@string/wso2_scheme,如果该字符串值不是https,系统无法匹配到对应的Intent Filter。
2. Data标签组合逻辑错误
多个<data>标签默认是逻辑或关系(满足任意一个标签的条件就触发),但你需要的是同时匹配Scheme、Host、Path,因此应该把这些属性合并到同一个<data>标签中,确保规则的完整性。
修复后的完整配置示例
<intent-filter> <action android:name="android.intent.action.VIEW" /> <!-- 必须添加该Action,否则无法触发Deep Link --> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <!-- 匹配https://www.omega.dk/app/examptpassword --> <data android:scheme="https" android:host="www.omega.dk" android:path="/app/examptpassword" /> <!-- 保留自定义Scheme的匹配规则(如果需要) --> <data android:scheme="@string/wso2_scheme" android:host="omega" android:path="/app/examptpassword" /> </intent-filter>
额外验证步骤
- 确认Activity配置:
<intent-filter>所在的Activity需显式设置exported="true"(Android 12+要求),否则无法接收外部Intent。 - 用adb命令测试(避免浏览器直接打开网页的干扰):
adb shell am start -W -a android.intent.action.VIEW -d "https://www.omega.dk/app/examptpassword"
内容的提问来源于stack exchange,提问作者Mahnoor Aslam
相关产品推荐
相关产品推荐

