Android 如何让安卓深度链接工作?

Android 如何让安卓深度链接工作?,android,deep-linking,Android,Deep Linking,更新:所以很明显,这没有任何变化。不知道为什么它以前不起作用 我正在遵循Android文档中的示例,但我无法让深层链接正常工作。当我尝试从adb启动时,出现以下错误: $ adb shell am start -a android.intent.action.VIEW -d "example://gizmos" com.example.deeplink Starting: Intent { act=android.intent.action.VIEW dat="example://gizmos"

更新:所以很明显,这没有任何变化。不知道为什么它以前不起作用

我正在遵循Android文档中的示例,但我无法让深层链接正常工作。当我尝试从adb启动时,出现以下错误:

$ adb shell am start -a android.intent.action.VIEW -d "example://gizmos" com.example.deeplink
Starting: Intent { act=android.intent.action.VIEW dat="example://gizmos" pkg=com.example.deeplink }
Error: Activity not started, unable to resolve Intent { act=android.intent.action.VIEW dat="example://gizmos" flg=0x10000000 pkg=com.example.deeplink }
这是舱单:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.deeplink" android:versionCode="1" android:versionName="1.0" >

    <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="21" />

    <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" >

        <activity android:name=".MainActivity" android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <activity android:name="com.example.deeplink.GizmosActivity" android:label="@string/app_name" >
            <intent-filter android:label="@string/app_name">
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:scheme="example" android:host="gizmos" />
            </intent-filter>
        </activity>

    </application>

</manifest>
完整项目如下:


我做错了什么?

一个解决办法是使用qrcode:@SimonMarquis:qrcode与这个问题有什么关系?你可以直接测试你的url方案。深度链接是url方案。您的应用程序是否已安装在设备上
adb shell pm list packages-f | grep com.example.deeplink
我已经用这个命令测试了您的Eclipse项目
adb shell am start-a android.intent.action.VIEW-d“example://gizmos“com.example.deeplink
,它可以正常工作。你确定你的应用程序已安装在你的设备上吗?@TomKincaid是的,它克隆了你的存储库,工作起来很有魅力;)
package com.example.deeplink;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;

public class GizmosActivity extends Activity {

public static String TAG = "debug";

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Intent intent = getIntent();
        String action = intent.getAction();
        Uri data = intent.getData();
        Log.v(TAG,action+" "+data.toString());
    }

}