You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Android 12及以上版本DeepLink跳转异常问题排查

Android 12及以上版本DeepLink跳转失效问题

我用Java开发了一款基于Android的example.com WebView应用。在Android 12之前的版本中,用户点击任意相关链接(例如https://example.com/xyz/)时,只要应用已安装,链接就会在APP内打开;但在Android 12及以上版本中,链接始终跳转到浏览器。

我已完成Android 12及以上版本DeepLink配置的全部必要步骤:

  • 更新Android Manifest文件
  • 使用APK生成的SHA256指纹创建assetlinks.json文件
  • 将assetlinks.json部署至服务器的https://example.com/.well-known/assetlinks.json路径
  • 校验assetlinks.json的准确性
  • 在Android端验证配置修改

测试结果显示「Success Host example.com grants app...」,但跳转功能仍未生效。以下是我的相关代码:

AndroidManifest.xml

<activity
    android:name=".MainActivity"
    android:exported="true"
>
    <!--  - - -Deeplink-->
    <intent-filter android:autoVerify="true" tools:targetApi="m">
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
        <data
            android:scheme="http"
            android:host="*example.com"
            android:pathPattern=".*" />
        <data
            android:scheme="https"
            android:host="*example.com"
            android:pathPattern=".*" />
    </intent-filter>
    <!-- Deeplink- - -  -->
    <meta-data
        android:name="android.app.lib_name"
        android:value="" />
</activity>

MainActivity.java

//...
@Override
protected void onCreate(Bundle savedInstanceState) {
    //...
    String URL = "https://example.com";
    Intent intent = getIntent();
    Uri data = intent.getData();
    if (Intent.ACTION_VIEW.equals(intent.getAction()) && data != null) {
        String path = data.getPath();
        URL += path;
    }
    webview.loadUrl(URL);
    //...
}

内容的提问来源于stack exchange,提问作者perps4214213

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.30 00:13:13